Normal Topic For Next Statement Variable (Read 14830 times)
NHUser
Full Member
***
Offline



Posts: 320
Location: Amherst, NH
Joined: Aug 2nd, 2010
For Next Statement Variable
May 8th, 2020 at 1:53pm
Print Post Print Post  
I want to set up a statement to use in an automated email.  I have three series of 10 elements each that are the same name except for the number at the end.  For example, RMA_MultiQty1, RMA_MultiQty2, etc.

I'm using a FOR/NEXT loop to set up the statement and I want to use the element names and use a variable at the end of the name to get all 10 results.  So I'll end up with a 10 line list with the info from three elements on each line.

I tried the program below but Sesame is not recognizing the "RMA_MultiQtyx" as the element "RMA_MultiQty1".

Any suggestions.

Thanks!

NHUser


var n as int
var x as string
var vMulti as string
var v1 as string
var v2 as string
var v3 as string

For n=1 to 10
     
x=@str(n)      
vMulti=VMulti+RMA_MultiQtyx +@Newline()
     

Next
WriteLN(vMulti)
  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: For Next Statement Variable
Reply #1 - May 8th, 2020 at 5:33pm
Print Post Print Post  
Hi Paul,

You'll need to use SetThisElement() and ThisElement to do that. Something like:
Code
Select All
var n as int
var x as string
var vMulti as string
var v1 as string
var v2 as string
var v3 as string

For n=1 to 10

x=@str(n)
SetThisElement("RMA_MultiQty" + x)
vMulti=VMulti+ThisElement +@Newline()
UnsetThisElement()

Next
WriteLN(vMulti)  

  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged