Reading multiple columns in one request
Hi All
Whats the best way to read multiple columns in one SelectSQL call and assign them to different variables?
Say i have variables v1, v2, v3 - that correspond to columns col1, col2, col3
Instead of writing
v1 = %selectSQL("select col1 from table")
v2 = %selectSQL("select col2 from table")
v3 = %selectSQL("select col3 from table")
I want to get all 3 values in one database hit, something like
tempVar = %selectSQL("select col1, col2, col3 from table")
v1 = tempVar[0]
v2=tempVar[1] etc.
I can think of one way to do this using a delimited select statement and then substring operations to get the values out. This sounds really weird. Another way is possibly through grids, but I don't want to create a dummy grid to just get these values out.
I'm sure this is a common pattern for which there is hopefully a straightforward solution !
HELP
Thanks
Have a nice day
Comments
-
You could try something like this...
%myMemo := %SelectSQL("SELECT column1, column2, column3 FROM myTable WHERE something = somethingelse)
%myColumnData1 := %myMemo[0]
%myColumnData2 := %myMemo[1]
%myColumnData3 := %myMemo[2]
Hope this helps,
Regards,
Paul
[this probably adddresses your earlier thread as well]
0 -
Thanks Paul ! I'll try this out.
0 -
Works perfect. Thanks!
0
Categories
- All Categories
- 123 Developer Announcements
- 54 Articles
- 154 General Questions
- 149 Thrust Services
- 57 Developer Hackathon
- 37 Thrust Studio
- 20.6K Analytics
- 4.2K AppWorks
- 9K Extended ECM
- 918 Core Messaging
- 84 Digital Asset Management
- 9.4K Documentum
- 33 eDOCS
- 190 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management
- 10 XM Fax
- Follow Categories