Tip

Get Multivalue Form A Single Lookup

Using a single DbLookup, retrieve multivalue
ex:Get all customer info in a doc for billing code.
Create a view (Customers)
-first col =Cust_ID Sorted
-second Col=
REM " The order of this list must not be changed!";
REM " However, you may append items to the list, as necessary.";

REM " 1 = ContactName";
REM " Get Address from Mail or Street";
REM " 2 = Address1";
REM " 3 = Address2";
REM " 4 = City";
REM " 5 = State";
REM " 6 = Zip";
REM " 7 = Country";
REM " 8 = ServiceBank";
REM " 9= Prefered language";

@If(ContactName="";"No Contact";ContactName):

@If(MailAddress1 !="";
MailAddress1:MailAddress2: MailCity:MailState:MailZip:MailCountry;
StreetAddress1:StreetAddress2:StreetCity:StreetState:StreetZip:StreetCountry):
@If(Services_1="1";"Yes";"No"):
@If(Language="";"French";Language)


=============

Action or agent

dbCp:=@DbColumn("":"NoCache"; "":""; (Customers); 1);
CompanyList := @If(@IsError(dbCp);"No Customers"; dbCp);

SelectedCompany := @Prompt([OKCANCELLIST]; "Select Customer"; "Please select a
customer from the list below..."; @Subset(CompanyList; 1); CompanyList);

Cancel := @If(SelectedCompany = 0 | SelectedCompany = "No Customers";
@Return(""); "");

CustList:=@DbLookup("Notes":"NoCache"; "":""; (Customers); SelectedCompany; 2);
value:=@If(@IsError(CustList);"";CustList);

FIELD Billable1:= SelectedCompany;

FIELD BillContact1:=@Subset(@Subset(value; 1); -1);
FIELD Bill1Address1:=@Subset(@Subset(value; 2); -1);
FIELD Bill1Address2:=@Subset(@Subset(value; 3); -1);
LookupBillState:=@Subset(@Subset(value; 5); -1);
LookupBillZip:=@Subset(@Subset(value; 6); -1);

FIELD BillCityStateZip1:=@Subset(@Subset(value; 4); -1) + @If(LookupBillState =
""; ""; ", " + LookupBillState) + @If(LookupBillZip = ""; ""; " " +
LookupBillZip) ;
FIELD Country:=@Subset(@Subset(value; 7); -1);
FIELD ServiceBank:=@Subset(@Subset(value; 8); -1);
FIELD PrefLanguage:=@Subset(@Subset(value; 9); -1);

""

This was first published in November 2000

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.