@DbLookup, @Contains, @Command([OpenView]) All not working as needed in R6

Have a navigator that has a hotspot with the following code. This is not working. What it needs to do is capture the users name and then find their document if listed and open it up. It uses and @contains and @dblookup and a openview at the bottom. It just bypasses all and goes to the manual. Does Anyone have any ideas?

FIELD TempLookup := @Name([Abbreviate];@UserName);

FIELD Start :=@Left(TempLookup;1);

FIELD Look1 := @If(

@Contains(Start;“A”:“B”:“C”:“D”);@DbLookup(“Notes”: “NoCache” ; “”; “(Names A-D)”;TempLookup;1);

@Contains(Start;“E”:“F”:“G”:“H”) ;@DbLookup(“Notes”:“NoCache”;“”;“(Names E-H)”;TempLookup;1);

@Contains(Start;“I”:“J”:“K”:“L”); @DbLookup(“Notes”:“NoCache”;“”;“(Names I-L)”;TempLookup;1);

@Contains(Start;“M”:“N”:“O”:“P”);@DbLookup(“Notes”:“NoCache”;“”;“(Names M-P)”;TempLookup;1);

@Contains(Start;“Q”:“R”:“S”:“T”);@DbLookup(“Notes”:“NoCache”;“”;“(Names Q-T)”;TempLookup;1);

@Contains(Start;“U”:“V”:“W”:“X”:“Y”:“Z”);@DbLookup(“Notes”:“NoCache”;“”;“(Names U-Z)”;TempLookup;1);@Prompt([Ok];“Entry Not Found”;“You have already created the necessary documents. Thank you! If you need to make modifications to any of the information you have provided please contact Doug Tignor. You may however reference the manual…”));

@If(@IsError(Look1);@Do(@Command( [OpenFrameset] ; “WebFrame” );@Return(@Prompt([Ok];“Entry Not Found”;“You have already created the necessary documents. Thank you! If you need to make modifications to any of the information you have provided please contact Doug Tignor. You may however reference the manual.”)));“”);

@Contains(Start;“A”:“B”:“C”:“D”) & @Matches(@DbColumn(“Notes”:“NoCache”;“”;“(Names A-D)”;1);@Trim(@ProperCase(TempLookup)));

view1 :=@If(@Contains(Start;“A”:“B”:“C”:“D”); “(Names A-D)”;@Contains(Start;“E”:“F”:“G”:“H”) ;“(Names E-H)”;

@Contains(Start;“I”:“J”:“K”:“L”);“(Names I-L)”;@Contains(Start;“M”:“N”:“O”:“P”);“(Names M-P)”;

@Contains(Start;“Q”:“R”:“S”:“T”);“(Names Q-T)”; @Contains(Start;“U”:“V”:“W”:“X”:“Y”:“Z”);“(Names U-Z)”;“”);

@Command([OpenView]; view1;@GetField(TempLookup));

@Command([OpenDocument]);

@Command([OpenView]; view1;@GetField(TempLookup));

@Command([FileCloseWindow])

Thanks so much for your help!

Subject: @DbLookup, @Contains, @Command([OpenView]) All not working as needed in R6

First:

FIELD TempLookup := @Name([Abbreviate];@UserName); FIELD Start :=@Left(TempLookup;1);

so looks like your - getting the first initial of the first name

FIELD Look1 := @If(@Contains(Start;“A”:“B”:“C”:“D”);@DbLookup(“Notes”: “NoCache” ; “”; “(Names A-D)”;TempLookup;1);

if the initial is a, b, c or d then do a lookup, OR

);@Prompt([Ok];“Entry Not Found”;“You…manual”));

prompt the user.

BUT - in the dbLookup, you’re using the original TempLookup value as the key. Check the first sorted column in the view called (Names A-D) to make sure that that name is in a “abbreviated” form. Notes can be picky about names and if they are in different forms (ie abbreviated vs. full canonical) they might not be matching exactly.

Second:

@If(@IsError(Look1);@Do(@Command( [OpenFrameset] ; “WebFrame” );@Return(@Prompt([Ok];“Entry Not Found”;“You…manual.”)));“”);

You can probably suffice with either the @Return or the @Prompt - but not both.

Third:

@Contains(Start;“A”:“B”:“C”:“D”) & @Matches(@DbColumn(“Notes”:“NoCache”;“”;“(Names A-D)”;1);@Trim(@ProperCase(TempLookup))); ← what is this doing?

view1 :=@If(@Contains(Start;“A”:“B”:“C”:“D”); “(Names A-D);…”");

<---  you may want to place a prompt here just to see if view1 is returning a value

@Command([OpenView]; view1;@GetField(TempLookup)); @Command([OpenDocument]);

@Command([OpenView]; view1;@GetField(TempLookup)); @Command([FileCloseWindow])

Just some observations…I hope they help…

Subject: Did this work in R5?

However

  1. If this is a hotspot on a Navigator Dont use FIELD …

as far as I know you cant use FIELD except on a FORM to store on a document

and hence @getField wont either

  1. your error checking misses a few options (like case and start cahar not in ragge

  2. why not change the sequence to make the code more readable


TempLookup := @Name([Abbreviate];@UserName);

Start :=@Uppercase( @Left(TempLookup;1)) ;

view1 :=@If(@Contains(Start;“A”:“B”:“C”:“D”); “(Names A-D)”;@Contains(Start;“E”:“F”:“G”:“H”) ;“(Names E-H)”; @Contains(Start;“I”:“J”:“K”:“L”);“(Names I-L)”;@Contains(Start;“M”:“N”:“O”:“P”);“(Names M-P)”; @Contains(Start;“Q”:“R”:“S”:“T”);“(Names Q-T)”; @Contains(Start;“U”:“V”:“W”:“X”:“Y”:“Z”);“(Names U-Z)”; @Return( @Prompt( [OK] ; “Error” ; “Invalid name” ) );

Look1 := @DbLookup(“Notes”: “NoCache” ; “”; View1 ; TempLookup;1);

@if( @isError( Look1) ;

… do whatever if doc DOES NOT exist ;

… do whatever if doc does exits )

Subject: Yes it did and Thank you!

Hi Alan, Thanks so much for the suggestion it worked. This code did work in R5 but, it seemed to not work once we upgraded. The code is in a hotspot on a navigator here is what I ended up with:

TempLookup := @Name([Abbreviate];@UserName);

Start :=@UpperCase( @Left(TempLookup;1)) ;

view1 :=@If(@Contains(Start;“A”:“B”:“C”:“D”); “(Names A-D)”;@Contains(Start;“E”:“F”:“G”:“H”) ;“(Names E-H)”; @Contains(Start;“I”:“J”:“K”:“L”);“(Names I-L)”;@Contains(Start;“M”:“N”:“O”:“P”);“(Names M-P)”; @Contains(Start;“Q”:“R”:“S”:“T”);“(Names Q-T)”; @Contains(Start;“U”:“V”:“W”:“X”:“Y”:“Z”);“(Names U-Z)”; @Return( @Prompt( [Ok] ; “Error” ; “Invalid name” )));

Look1 := @DbLookup(“Notes”: “NoCache” ; “”; View1 ; TempLookup;1);

@If(@IsError(Look1);@Do(@Command( [OpenFrameset] ; “WebFrame” );@Return(@Prompt([Ok];“Entry Not Found”;“You have already created the necessary documents. Thank you! If you need to make modifications to any of the information you have provided please contact Doug Tignor. You may however reference the manual.”)));“”);

Look2 := @If(@IsError( Look1);

@Prompt([Ok];“This is an error”;“Error”);

@Do(@Command([OpenView]; view1; TempLookup);

@Command([OpenDocument]);

@Command([OpenView]; view1; TempLookup);

@Command([FileCloseWindow])));

Look2

Thanks again,

Dawn