Embedded SQL in AutoScript (2)


In cases where there is need for an one-line SELECT statement then is better to use SelectFrom predefined function together with the GetStrArgumentNo. The usage is as follows:

str = SelectFrom("SELECT COMM, UNAME, RNAME, AU_BUSINESS FROM AU_STEP WHERE (AU_STEP=",rec_id,")")
sep = Escape(1,-1)      { ....the separating character is asci 1}
comm    = GetStrArgumentNo(str,sep,1)     
uname   = GetStrArgumentNo(str,sep,2)                  
rname   = GetStrArgumentNo(str,sep,3)          
bus_id  = GetStrArgumentNo(str,sep,4)

or for a single value return

comm = SelectFrom("SELECT COMM FROM AU_STEP WHERE (AU_STEP=",rec_id,")")