Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Experts,
I have the following Question, I hope I could Get any help:
I am Loading the Following:
Load
Field1,
Field2,
Field3 as Field
From Database;
I am wondering how can I accomplish the following as It gives me an error.
Load
Field1,
Field2,
Field3 as Field,
Field + 1 as Result
From Database;
How can I Use the aliased field within the same Script in the way shows above?
Thanks in advanced
Hey Andres,
The alias "Field" is what gets stored into the new qlik data table loaded into memory, you're still pulling from the Database which retains its names. So for this, you simply need to reference Field3 instead of Field.
Load
Field1,
Field2,
Field3 as Field,
Field3 + 1 as Result
From Database;
If you are trying something a little bit more complicated, you can use a Preceding Load to access the created table and add new custom fields.
Load
*,
Field + 1 as Result
;
Load
Field1,
Field2,
Field3 as Field
From Database;
by Preceding load:
//preceding load above your original code
Load
Field1,
Field2,
Field3,
Field + 1 as Field4;
// your original code
Load
Field1,
Field2,
Field3 as Field
From Database;
by Resident load
// your original code
Original:
Load
Field1,
Field2,
Field3 as Field
From Database;
//preceding load below your original code
Load
Field1,
Field2,
Field3,
Field + 1 as Field4
RESIDENT Original; // Resident keyword
Hi,
You cann't able to use alise name in condition and here you are fetching datas directly from table so its not possible . Create that field as a separate table and use it
load *, Field + 1 as result;
load Field1,Field2,Field3 as Field
from table;