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

Using fields from multiple data sources in IF statement

Hi there,

I'm trying to use fields from different QVD data sources (field A from table B) and (field G from table C) within an IF statement and keep getting an error.

Example of the script I am attempting:

====================================================================================================================

Table A:

LOAD *,

IF(Field A = 'X', IF(Field G = 'Y', 'Yes', 'No')) AS IF_Statement;

Table B:

LOAD      A AS Field A,

               B AS Field B,

               C AS Field C,

               D AS Field D,

FROM

DATASOURCEB.qvd;

Table C:

LOAD      A AS Field A,

               E AS Field E,

               F AS Field F,

               G AS Field G,

FROM

DATASOURCEC.qvd;

====================================================================================================================

Within the Table Viewer the two data sources are correctly linked on Field A

However, when I attempt to run this I get an error message stating:

Field Not Found - <Field G>

Help ?

           

2 Replies
Gysbert_Wassenaar

You can only reference fields in the source table you're loading in a load statement. If you need fields from several tables than you will have to join the tables first so you get one table with all the fields you need in one table. In some cases you can use the lookup function. Check the help file to see if it can be used to do what you want.


talk is cheap, supply exceeds demand
Not applicable
Author

Hi,

You must define FROM clause for Table A.

Try to join Table B and Table C on Field A.

Dev_table:

LOAD * RESIDENT B;

join

LOAD * RESIDENT C;

Afer that load Table A, which is resident from Dev_table.

Yani