Subject: RE: Help with designing form.
Here a sample piece of code, in this case I’m selecting a Test # to get information (i put the . . to preserve the tabs incase you’ve viewing via the web)
Everything above the List := @DBLookup is just me trying to have a standard format so I can copy the code to another area and just change the FieldName and Srv and Path Information.
FieldName := “TestMethodNo”;
Srv := MethodSrv;
Path := MethodPath;
OrgVal := @GetField(FieldName);
Key := “Testing”;
ViewName := “luMIbyMethod”;
Values := 2;
PromptTitle := “Select Test Number”;
PromptMsg := “Select from the following:”;
ErrMsg := (Key + " not found on the “):(ViewName + " view.”):(OrgVal);
List := @DbLookup( “”:“NoCache” ; (Srv: Path) ; ViewName ; key; Values );
cList := @If(@IsError(List) ; ErrMsg ; @Unique(@Trim(List)) );
Ans := @Prompt([OkCancelList]:[NoSort]; PromptTitle; PromptMsg; OrgVal; cList);
@If( @IsError(Ans); “”;
. . . . @Do(
. . . . . . . . @SetField(FieldName;Ans);
. . . . . . . . ViewName :=. . “luMIbyMTNo”;
. . . . . . . . Ans := @DbLookup( “”:“NoCache” ; (Srv: Path) ; ViewName ; Key+Ans; 2);
. . . . . . . . . @If(@IsError(Ans);“”; @Do(
. . . . . . . . . . . . list := @Explode(Ans;“~~”);
. . . . . . . . . . . . @SetField(“TestMethodNo”; list[1]);
. . . . . . . . . . . . @SetField(“TestCost”; @If(list[2]=“”; 0; @TextToNumber(list[2]) ));
. . . . . . . . . . . . @SetField(“TestProcType”; list[3]);
. . . . . . . . . . . . @SetField(“NoSample”; @If( list[4]=“”; 0; list[4] ));
. . . . . . . . . . . . @SetField(“TestNonStndDetails”; list[5]);
. . . . . . . . . . . . @SetField(“TestType”; list[6])
. . . . . . . . . . )
. . . . . . . . )
. . )
);