Getting a proper formated string in LS

In an application that I am developing I need to generate a text string that looks like this:

“VarOne” : “VarTwo” : “VarThree” : etc

The LS I’m using is as follows:

For X = 1 To 20

	Obj = Pdoc.GetItemValue("ReadObject_" + Cstr(X))(0)

	If Not(Obj = "") Then

		If X = 1 Then

			ReadObjects = Obj 

		Else

			ReadObjects = ReadObjects + " : " + Obj 

		End If

	End If

Next

WHen I’m finished the variable ReadObjects in the Debugger looks like this:

“VarOne : VarTwo : VarThree”

I have tried every combinations of " | that I can think of and always end up with the ReadObjects looking like this in the debugger:

“”“VarOne”" : ““VarTwo”” : ““VarThree””"

What I am trying to end up with is a string that I can use to modify a Selection formula so that it will look something like this

@ISMember(ObjectName; “VarOne” : “VarTwo” : “VarThree”)

Any help would be appreciated (BTW it has to be in LS because of other things that are going to be happening in the agent)

Thanks for you help

Subject: Getting a proper formated string in LS

If I am reading this right you have 20 fields on your document called ReadObject_1, ReadObject_2, ReadObject_3 etc

Why not add a computed or computed for display multi value text field with the formula

ReadObject_1 : ReadObject_2 : ReadObject_3 etc

Subject: Getting a proper formated string in LS

Bill,

I think this will do it, or will be a step in the right direction:

ReadObjects = ReadObjects & { : “} & Obj & {”}

regards,

raphael

Subject: Solved

Thanks for your help here is what the final code looked like:

Part1 = |SELECT Form = “frmLogHit” & Verb = “Read” & @ISMember(ObjectName; |

For X = 1 To 20

	Obj = Pdoc.GetItemValue("ReadObject_" + Cstr(X))(0)

If Not(Obj = "") Then

	If X = 1 Then

		ReadObjects = Obj 

	Else

	If X = 2 Then

	        ReadObjects = ReadObjects & {"} & { : "} & Obj & {"}

	Else

		ReadObjects = ReadObjects & { : "} & Obj & {"}

	End If

		

End If

	End If

Next

Formula = Part1 + {"} + ReadObjects + ");"

vw.SelectionFormula = Formula

It still not fully ready for production but I’m on the right track now.

Again BIG thanks!!! The small problems are always the hardest to figure out.

Subject: Getting a proper formated string in LS

Don’t create a string value. Create a dynamic array and populate it as you loop. Then set a multi-value field value with the array result and use that fieldname as your list field in the @ismember formula.

Subject: Getting a proper formated string in LS

Are you trying to store “VarOne” : “VarTwo” : “VarThree” in a field and then use it later as @ISMember(ObjectName; “VarOne” : “VarTwo” : “VarThree”) ?

If so store the values in loop in a variant and then update the document’s multivalue field with that variant.

dim v as variant

For X = 1 To 20

Obj = Pdoc.GetItemValue(“ReadObject_” + Cstr(X))(0)

If trim$(Obj) <> “” Then

If X = 1 Then redim v(X-1)

If X > 1 then redim preserve v(X-1)

v(X-1) = Obj

End If

If IsArray(v) then

doc.YourMultiValueField = v

doc.Save(True, True)

end if

Later you can use the selection formula as:

@ISMember(ObjectName; YourMultiValueField)

Subject: RE: Getting a proper formated string in LS

The problem is the values are in a profile document that the user enters then I need to change the Selection formula accordingly. I was able to resolve the problem with a little help from my friends in the forum here. See my solution:

http://www-10.lotus.com/ldd/nd6forum.nsf/DateAllThreadedweb/17e7992da685759385257241006dd13e?OpenDocument