Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I need to load a files like this:
A:
col1
col2
[col3 2012] as col3
[col4 2012] as col4
FROM table 2012;
B:
col1
col2
[col3 2013] as col3
[col4 2013] as col4
FROM table 2013;
....
I want to avoid manual adding script every year so wanted to use loop with a variable. I know how to run the loop, however i cant manage to load the two fields (col 3 and 4) as variables... Could you please suggest how to do that?
Many thanks
J.
Hi,
I think this loop could help:
for i = 2012 TO 2013
LET vField1 = 'col3 ' & '$(i)';
LET vField2 = 'col4 ' & '$(i)';
LET vQVDName = 'Table ' & '$(i)';
LOAD
col1,
col2,
[$(vField1)] as col3,
[$(vField2)] as col4
FROM [$(vQVDName).qvd]
NEXT
You could use the columns position:
@3 as col3
- Marcus
That could help, but i am loading a qvd... so no chance for no labels.
Any other idea?
J.
Hi,
I think this loop could help:
for i = 2012 TO 2013
LET vField1 = 'col3 ' & '$(i)';
LET vField2 = 'col4 ' & '$(i)';
LET vQVDName = 'Table ' & '$(i)';
LOAD
col1,
col2,
[$(vField1)] as col3,
[$(vField2)] as col4
FROM [$(vQVDName).qvd]
NEXT
Perfect. It works.
Thanks Anatoly.
J.