Hi,
I have a form in which there is a lookup button. On the click of that Lookup button a view will open. The user selects a document and based upon the Name in the document some values from the view are updated in the current open document. It is working fine. The problem here is when there are more than one document in the view which has the same Name, the current open document is being updated with the values from more than one document. How can this be restricted to update from only the document which user has selected. Below is the code that i have written. Can anyone help me on this. Thanks in Advance.
B:=@PickList( [Custom] : [Single] ; Db ;“View Name”; “Lookup” ; “Please select a document” ; 2);
@If(@Length(B) > 0; @SetField(“F1”; B); @Return(“”));
C:=@DbLookup(“Notes”; DB; “LookupClient”; B; “ID”);
@If(@Length(B) > 0; @SetField(“F1”; @DbLookup(“Notes”; DB; “LView”;C; “Client”));@Return(“”));
@If(@Length(B) > 0; @SetField(“F2”; @DbLookup(“Notes”; DB; “LView”;C; “ID”));@Return(“”));
@If(@Length(B) > 0; @SetField(“F3”; @DbLookup(“Notes”; DB; “LView”; C; “Reg”)); @Return(“”));
@If(@Length(B) > 0; @SetField(“F4”; @DbLookup(“Notes”; DB; “LView”; C; “Loc”)); @Return(“”));
@If(@Length(B) > 0; @SetField(“F5”; @DbLookup(“Notes”; DB; “LView”; C; “Ind”)); @Return(“”));
@If(@Length(B) > 0; @SetField(“F6”; @DbLookup(“Notes”; DB; “LView”; C; “CM”)); @Return(“”))
Subject: Picklist and DBLookup
Hi Rao,
try this…
B:=@PickList( [Custom] : [Single] ; Db ;“View Name”; “Lookup” ; “Please select a document” ; 2);
B := @Subset(B; 1);
@If(@Length(B) > 0; @SetField(“F1”; B); @Return(“”));
Regards,
Byju Joy
Subject: Picklist and DBLookup
Narsimha,
In terms of performance, you’re doing 7 lookups after your picklist. If that’s of no importance, then I’ve got no problem with it, but if this slows down then you might want to consider ways to streamline this lookup.
You could make a view that has all six pieces of information concatenated in a 2nd column, return that column and then parse the six values into your six fields.
You could use lotusscript and once the picklist selection has been made, and you already have a handle to the document, you could pull the six fields out there.
Just some thoughts,
regards,
raphael
Subject: Picklist and DBLookup
The @DbLookup you are doing against the “LView” view…I would recommend that either in that view or on those documents, you have the Client, ID, Reg, Loc, Ind, and CM fields concatenated with delimiters.
“Client~ID~Reg~Loc~Ind~CM”
Then you can have your formula do something like (imagine your 8th column in LView has this string):
vCust:=@PickList( [Custom] : [Single] ; Db ;“View Name”; “Lookup” ; “Please select a document” ; 2);
@If(vCust=“”;@Return(“”);“”);
list:=@DbLookup(“”:“Nocache”;“”;“LView”;vCust;8);
@SetField(“F1”;@Subset(list;1);
@SetField(“F2”;@Subset(@Subset(list;2);-1);
@SetField(“F3”;@Subset(@Subset(list;3);-1);
@SetField(“F4”;@Subset(@Subset(list;4);-1);
@SetField(“F5”;@Subset(@Subset(list;5);-1);
@SetField(“F6”;@Subset(@Subset(list;6);-1);
I may be misunderstanding what your formula is doing, because I see you have two separate @SetFields for the F1 field.
Good luck.
Matt