Hi
list:=@DbLookup(“”:“NoCache”;@ServerName:“abc.nsf”;“PDetails”;pcode;4;[FailSilent]);
@If(list=" “;@Nothing;@Trim(@Explode(@DbLookup(”“:“NoCache”;@ServerName:“abc.nsf”;“PDetails”;pcode;4);”,")))
This above formula is in Dialog list field.
Problem : If the dblookup fetch empty value then dialog list show one empty value in the dialog list field. It is showing its length=1. How can make length=0 and no value in the dialog list field if result of @dblookup is nothing.
It is used in web based application.
please help
Thanks
Subject: Problem with Dialog list
You can’t. Remember, the field will be created on the document with a value of “” if no choice is made anyway as long as the field widget appears on the form. By the way, @Nothing is meaningless unless it’s used in an @Transform formula.
Subject: Problem with Dialog list
try list:=@DbLookup(“”:“NoCache”;@ServerName:“abc.nsf”;“PDetails”;pcode;4;[FailSilent]);@if(list=“”;“”;@trim(@explode(list;“,”))) or if you get a space use
@if(list=“”;“”;list=" “; “”; @trim(@explode(list;”,")))
the failsilent returns “”, the second lookup is not needed (and slow) and is missing the failsilent
Subject: RE: Problem with Dialog list
I had already tried this but the issue was not resolved… I do not know why the problem is coming…
Subject: Problem with Dialog list
I’ll take a shot at it with a little more verbose formula:
che:=“”:“NoCache”;
db:=@Servername:“abc.nsf”;
view:=“PDetails”;
list:=@DbLookup(che;db;view;pcode;4;[FailSilent]);
@If(list=“”;
"";
@Trim(@Explode(list;",")))
Try copy/paste that into your formula. Also, not sure where you are looking when you say it shows its length is 1.
Subject: RE: Problem with Dialog list
Offhand, I’d say that he’s looking at document.forms[0].FieldName.options.length. The only solutions, really, would be to either hide the field when there is only a single blank choice (Domino server-side) or to set the options.length to 0 when options.length is 1 and options[0].text is “”. That will not keep Domino from creating the field on the document with an empty value, but this question has been ongoing for a week or so and “can’t be done” doesn’t seem to ring in the poster’s ear.
Subject: Problem with Dialog list
It`s not the same problem but maybye it could help:
I do test if Result have some elements. If not, I do fill it directly. If yes, I add elements into it.
@For( n := 1; n <= @Elements( List ); n := n + 1;
@If( @Elements( Result ) = 0; Result := “something”; Result := Result:“something” )
)
Works very well.