Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to load from ODBC if a condition from another qvd is met?

I have a qvd with reserving lines that is referenced at the beginning of the script. However after loading all of the mappings, I would only like the ODBC connect statement to be executed if only one of the reserving lines is selected (i.e only proceed with ODBC connect if casualty is selected, skip the process if not). Can anyone help me figure out the structure?

1 Reply
felipedl
Partner - Specialist III
Partner - Specialist III

Hi Santiago,

Since you haven't provided much information on how your data is organized, I made a simple example that can achieve what you want.

Sample:

LOAD * Inline

[

ID,Reserved,ConnectionString

1,N,XYZ

2,N,ABC

3,Y,DEF

];

NoConcatenate

ConnectODBC:

Load

*

Resident Sample

Where Reserved = 'Y';

drop table Sample;

if (NoOfRows('ConnectODBC') = 1) then

trace Only 1 Row selected.;

let vConnectString = peek('ConnectionString',0,'ConnectODBC');

trace Connection String: $(vConnectString);

else

trace(Multiple Rows selected, no connection made!!!);

End if;

The above code can get the connection string only if one condition is met.

Felipe.