Hello all - In my script below, I sometimes pull back multiple values for x when there are more than 1 document that meet the search criteria. I am trying to pull back just the first element od the value x but when I do, I get the first value of a multivalued x but just a “,” for a single valued x
Any Idea how I can get the first value regardless?
FIELD SerialNum:=SerialNum;
FIELD AssetCenterStatus:=AssetCenterStatus;
REM {Grab the Machine Name from the Asset Center record};
MachineRes:=@DbLookup(“”:“NoCache”;“”; “ACMachineID”;SerialNum;1);
REM {Grab the Assignment(Status) from the Asset Center record};
StatusResult:=@DbLookup(“”:“NoCache”;“”; “ACMachineID”;SerialNum;12);
REM {Match on Machine Name and set the value of x};
x:=@If(@IsError(MachineRes);“Machine not found in AC”;
@Contains(MachineRes;SerialNum);StatusResult;
“no match”);
REM {Set the value of the AssetCenterStatus field to the value of x};
@SetField(“AssetCenterStatus”;@If(@Elements(x)>1;@LeftBack(x;“,”);x));