Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

markgraham123
Contributor II

Syntax in expression error: Resident and Preceding load

Hi,

Im trying to fetch ID, Barcode1, Barcode2,Units1, Units2 from Table1 and do the following operation.

But getting the error: "Syntax error in Expression"

Please lemme knw if there is any mistake i'm doing!

Load ID, B1, B2, Sum(U1) as FirstSum, Sum(U2) as SecondSum

Group By SKU#;

Load ID, Barcode1 as B1, Barcode2 as B2, Units1 as U1, Units2 as U2

Resident

Table1;

1 Solution

Accepted Solutions
prabhu0505
Valued Contributor

Re: Syntax in expression error: Resident and Preceding load

Try this:

Load ID, B1, B2, Sum(U1) as FirstSum, Sum(U2) as SecondSum

Group By ID, B1, B2;  // Group by should have all non agreegated fields

Load ID, Barcode1 as B1, Barcode2 as B2, Units1 as U1, Units2 as U2

Resident

Table1;

5 Replies
MVP
MVP

Re: Syntax in expression error: Resident and Preceding load

Your aggregation field in the GROUP BY clause is SKU# and no other fields than the aggregation fields may be used outside aggregation functions in the loaded expressions. Hence you'll either need to add ID, B1, B2 to the aggregation fields in the clause or embed these in aggregation functions.

prabhu0505
Valued Contributor

Re: Syntax in expression error: Resident and Preceding load

Try this:

Load ID, B1, B2, Sum(U1) as FirstSum, Sum(U2) as SecondSum

Group By ID, B1, B2;  // Group by should have all non agreegated fields

Load ID, Barcode1 as B1, Barcode2 as B2, Units1 as U1, Units2 as U2

Resident

Table1;

Not applicable

Re: Syntax in expression error: Resident and Preceding load

In your script SKU# is not present in the table 1. If you have that in your actual table and you want to group by values over it, then use appropriate aggregation function for ID, B1 and B2 also (If it make sense :-)). Something similar to below

Load

SKU#,

Min(ID) as ID

,Min(B1) as B1

,Min(B2) as B2

,Sum(U1) as FirstSum,

Sum(U2) as SecondSum

Group By SKU#;

Load ID, Barcode1 as B1, Barcode2 as B2, Units1 as U1, Units2 as U2, SKU#

Resident

Table1;

Regards,

KKR

markgraham123
Contributor II

Re: Syntax in expression error: Resident and Preceding load

Hi Saravana,

Got it.

thanq very much.

markgraham123
Contributor II

Re: Syntax in expression error: Resident and Preceding load

Hi Kranthi,

Sorry for the mistake.

It was Group by ID;

Community Browser