Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am trying to pass variable from either column3 or column4 to a column5 on the same row, depending on condition. But the result does not correspond the row.
I am aware that Peek() evaluates by load order - but dos it not stay on the same row in a line of script?
table1:
LOAD * INLINE [
Country, Continent, Heat, Rain
Argentina, South America, Mild, Rainy
Mexico, North America, Hot, Dry
Sweden, North Europe, Cold, Snow
Cyprus, South Europe, Hot, Humid ];
table2:
LOAD *,
If(Left(Continent,5) like '*North*',Peek('Heat'),Peek('Rain')) as Climate
Resident table1;
Well, probably because column1 contains country names and column3 contains a temperature indication. And the peek function looks at the previous row of the target table. So, no it does not stay on the same row. That's why it's called in inter record function. Perhaps you want this instead:
LOAD *, If(Left(Continent,5) = 'North',Heat,Rain) as Climate
Resident table1;
Apologies, I have corrected the column numbers. I am looking to pass value from either column3 or column4 to column5.
I see your point - I don't need to use Peek() at all.
Is it possible to peek to the same row without for loop?