I want to concatenate a string with multiple value with forall loop here is the code :
varAttachmentNames = Evaluate( "@AttachmentNames" , doc )
Forall strAttachmentName in varAttachmentNames
Set object = doc.GetAttachment( strAttachmentName )
fileName = object.Name
End Forall
at the end of loop if there is multiple files i want there names as abc.pdf##xyz.pdf both are seprate file names abc and xyz in fileName (string variable)
There are a LOT possibilities, some not even needing the LotusScript- Loop:
First: Do the concatenation in Formula already:
Dim strResult as String
varAttachmentNames = Evaluate( {@Implode( @AttachmentNames , "##")} , doc )
strResult = varAttachmentNames(0)
Second: Use the @Implode- counterpart in LotusScript:
Dim strResult as String
varAttachmentNames = Evaluate( "@AttachmentNames" , doc )
strResult = Implode( varAttachmentNames, "##" )
' or with the (in other programming languages) more common alias "Join":
'strResult = Join( varAttachmentNames, "##" )
Third: Use your Forall- Loop:
Dim strResult as String
varAttachmentNames = Evaluate( "@AttachmentNames" , doc )
Forall strAttachmentName in varAttachmentNames
Set object = doc.GetAttachment( strAttachmentName )
fileName = object.Name
If strResult = "" then
strResult = fileName
Else
strResult = strResult & "##" & fileName
End If
End Forall