Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I get this error while trying to run this script. it says:
Error in expression: ')' expected and Table 'TEMP_FACT' not found
What am i doing wrong? Thanks
TEMP_FACT:
LOAD
AssetModelKey,
AssetStatusKey
FLAG, ....etc
FROM
$(vQVD)Fact1.qvd
(qvd);
FACT:
Load *,
IF((FLAG='INV' AND Match(AssetStatusKey,'2','4')), RangeSum(Count(AssetModelKey),Peek('AccumulateInventory')), Count(AssetModelKey)) as AccumulateInventory,
IF((FLAG='INV' AND Match(AssetStatusKey,'3','5')), RangeSum(Count(AssetModelKey),Peek('AccumulateSold')), Count(AssetModelKey)) as AccumulateSold
Resident TEMP_FACT;
DROP TABLE TEMP_FACT
Your TEMP_FACT table may need a comma separating your field name AssetStatusKey from FLAG.
Your FACT table is using aggregation functions like Count() without a GROUP BY clause, which will not work.
I added Group By, but it still give me the same error:
TEMP_FACT:
LOAD
AssetModelKey,
AssetStatusKey,
FLAG,
AgrmntNo
....etc
FROM
$(vQVD)Fact1.qvd
(qvd);
FACT:
Load *,
IF((FLAG='INV' AND Match(AssetStatusKey,'2','4')), RangeSum(Count(AssetModelKey),Peek('AccumulateInventory')), Count(AssetModelKey)) as AccumulateInventory,
IF((FLAG='INV' AND Match(AssetStatusKey,'3','5')), RangeSum(Count(AssetModelKey),Peek('AccumulateSold')), Count(AssetModelKey)) as AccumulateSold
Resident TEMP_FACT
Group By AgrmntNo;
DROP TABLE TEMP_FACT
Is this really one single error message or do you see several errors popping up one after the other?
If you add an exit script statement before the FACT table load, does it execute without error?
Your GROUP BY needs to list all fields that are not used within aggregation functions, hence since you are using a star symbol in your FACT table load, you at least are missing FLAG, AssetModelKey, AssetStatusKey, AgrmntNo fields in your group by.
it is actually several errors popping after another.
if i add exit script it still gives the error ') is expected'
Then maybe start with posting your full LOAD statement for TEMP_FACT table and also double check the variable vQVD.
edit: And please post full error message (e.g. using a screen shot).
The issue may even arise from a statement that appears before the TEMP_FACT table LOAD.