SQLlookup

Q:
I am currently working on a web app where I need to perform some server side data retrieval.

While referencing SQLLOOKUP, when the virtual table is used, the return value is the customer id.

Is it possible to have multiple returned values?
For example, can the return value be customerid and employeeid.

If it is not possible, other than calling SQLLOOKUP() several times, what would be the best way to use the same functionality with virtual tables?
I am trying to make a call to a virtual table that returns two columns from a table.
I would then taken the values, place them in a JSON string format and return the encoded object to the client.

I am currently using two sqllookup calls and I’m trying to make it easier with one single call.

Code:
m_defbranch = sqllookup("vtsecure","where loginname = '" + m_username + "'", "","defbranch","'Not found'")

m_colcode = sqllookup("vtsecure","where loginname = '" + m_username + "'", "","collcode","'Not found'")

I am storing each of the values in the caption of a label in a canvas section for other uses (which will not be visible to the user).
A:
The easiest nocode way I can think of: put a canvas section on the page that is invisible.
Put
two textboxes on the section set to the two fields you want to use.
Set the
datasource to be a VT which will give you the values you want.

When you need to requery() (here’s another place where having all the details would make a difference), set the WHERE attribute of the section..
I’m not sure if it will
requery itself, or where you will then have to requery the section. One way or the other, your two values will be available for you to use as you need.



Advertisements

SQLlookup

Q:
Why is a wrong field shown in column “groep”.
choices: SELECT omschrijving FROM groep WHERE bedrijf = 234 AND periode = 2015
Get data mapping : sqllookup(“groep”,”where bedrijf = 234 AND periode = 2015 AND groep = ‘{}'”, “”,”omschrijving”,”0″)
Swt data mapping : sqllookup(“groep”,”where bedrijf = 234 AND periode = 2015 AND omschrijving = ‘{}'”, “”,”groep”,”0″)
A:
What are the datatypes of groep and omschrijving?
If they are character, the final parameter (notfound) in SQLLOOKUP() should be in quotes within quotes “‘0′”