Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all
I am having some inter-record difficulty on my LOAD script.
What i want to do to get values on the same line i am busy loading.
I have tried Peek, but that only uses above. I have also tried FieldValue(xxx,1) but that just gives me a null.
Basically i'm looking for something simple like
IF(record1 < record2, 'xxx', 'yyy')
But at least if i understand what function to use i can build on it.
Please help as i am really stumped.
Thankyou
If you want to compare two fields of the same record then use something like: if(FieldA < FieldB, 'xxx', 'yyy') as FieldC. Make sure that FieldA and FieldB are of datatypes that can be compared that way. Is that what you're trying to do or do you want to compare fields of different records?
They are both values.
Here is a simplified example. The calculations are a lot more complex than displayed here, so it is difficult to bring the full calculation in each time:
1+2 AS Field1,
2+2 AS Field2,
IF(Field1 < Field2, 'xxx', 'yyy') AS NewField;
But then it sais
Field not found - <Field1>
...
Yeah, you can't reference 'new' names created with AS NewName. You'll have to use the original fieldname (or expression). You can use a preceding load:
load *, if(fieldA < fieldB, 'xx','yy') as fieldC;
load
1+2 as fieldA,
2+2 as fieldB
from ....;
This is quite nice. I didn't know that it could work like this...
Will have a look it seems to be what i'm looking for
Thanx
Unfortunately this method didn't work, and in the end it was best to just do the calculations over again.