Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Creating a field by concatenating 2 string fields but when trying to apply an "Exists" on the same in a succeeding load, the load fails with "Unable to find the field". While the exists worked fine for a singular numeric field (and maybe string too, but I haven't used it with a string field) but load fails in this scenario . Any suggestions as to how can that be resolved?
-Priyanka
Hi. Please find a sample data below with the script:
Table1 Table2
Item |Price |Month Item |Price | Month
Book1 D73 May Book7 D99 Jun
Fan1 D85 May Fan3 D67 Jun
Fan1 D85 Jun
Fan5 D56 Jun
DB_May:
LOAD "Item"&'_'&"Price" AS "Item_Price";
SQL SELECT "Item",
"Price"
FROM ABC."May_Data"
WHERE "Item" IS NOT NULL
AND "Price" IS NOT NULL;
DB_Jun:
LOAD "Item"&'_'&"Price" AS "Item_Price",
If(Exists("Item_Price"), 'Existing', 'New') as "Item_Price_Flag";
SQL SELECT "Item",
"Price"
FROM ABC."Jun_Data"
WHERE "Item" IS NOT NULL
AND "Price" IS NOT NULL;
So basically I want to check if a combination of these 2 fields have occurred before in the previous month or not.
-Priyanka Negi
Can you share your script you are trying to run?
Maybe try Preceding load as it cannot find the newly created field?
Table123:
//Preceding Load
Load *,
Full_Name;
//OriginalLoad
Load
a,
b,
c.....,
a & ' ' & b as Full_Name
From....
Where Not Exists (Full_Name);
Hi. Please find a sample data below with the script:
Table1 Table2
Item |Price |Month Item |Price | Month
Book1 D73 May Book7 D99 Jun
Fan1 D85 May Fan3 D67 Jun
Fan1 D85 Jun
Fan5 D56 Jun
DB_May:
LOAD "Item"&'_'&"Price" AS "Item_Price";
SQL SELECT "Item",
"Price"
FROM ABC."May_Data"
WHERE "Item" IS NOT NULL
AND "Price" IS NOT NULL;
DB_Jun:
LOAD "Item"&'_'&"Price" AS "Item_Price",
If(Exists("Item_Price"), 'Existing', 'New') as "Item_Price_Flag";
SQL SELECT "Item",
"Price"
FROM ABC."Jun_Data"
WHERE "Item" IS NOT NULL
AND "Price" IS NOT NULL;
So basically I want to check if a combination of these 2 fields have occurred before in the previous month or not.
-Priyanka Negi
Please find the sample data and script above. And the field should be present as it is already loaded in a table preceding to the current load. Can you please check the script and tables above.
Are you looking something like below:
Table1:
LOAD *, Item&'_'&Price AS ItemPrice INLINE [
Item,Price,Month
Book1, D73, May
Fan1, D85, May
];
Join(Table1)
Table2:
LOAD *, IF(Exists(ItemPrice, ItemPrice), 'Exists', 'New') AS ItemFlag;
LOAD *, Item&'_'&Price AS ItemPrice INLINE [
Item,Price,Month
Book7, D99, Jun
Fan3, D67, Jun
Fan1, D85, Jun
Fan5, D56, Jun
];