Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Script Error........!

Hi All,

I have same product codes in my data base with different prices. so what I do is, product codes renamed in my script as follows.

IF(PRD_CODE='LI' AND 600<GRO_PRE>650, PRO_CODE="LI1"),

IF(PRD_CODE='LI' AND 1150<GRO_PRE>1250, PRO_CODE="LI2"),

IF(PRD_CODE='LI' AND 1550<GRO_PRE>1650, PRO_CODE="LI3"),

In the script above conditions are not shows an error but script can not loaded. The machine is getting stuck. 

Please  help to solve the problem.

Regards,

Priyantha

5 Replies
jduenyas
Specialist
Specialist

Try

IF(PRD_CODE='LI' And GRO_PRE > 600 And GRO_PRE < 650, PRO_CODE='LI1')  Etc.

Watch out for the double quotes as you have it at the end of the statement. Should be single quote.

Josh

Not applicable
Author

Hi Piyantha, you may have different prices for the same product code because of you are using different price list, Try to bundle price list and product code together  generate a unique product code. or if you want just distinct product codes, just load sql with DISTINCT or  use MODE() function.

jyothish8807
Master II
Master II

Hi Priyantha,

Try like this:

IF(PRD_CODE='LI' AND GRO_PRE > 600 And GRO_PRE < 650, Replace(PRO_CODE,'LI','LI1')

Regards

KC

Best Regards,
KC
Not applicable
Author

you can use following SCRIPT to bundle the pricelist and productcode product &  '|' &  pricelist as Productkey,

Sokkorn
Master
Master

Hi Priyantha,

Can you check logic which I have highlight below. It seem not make sense.

PRIYANTHA BANDARA wrote:

IF(PRD_CODE='LI' AND 600<GRO_PRE>650, PRO_CODE="LI1"),

IF(PRD_CODE='LI' AND 1150<GRO_PRE>1250, PRO_CODE="LI2"),

IF(PRD_CODE='LI' AND 1550<GRO_PRE>1650, PRO_CODE="LI3"),

Anyhow, here is my idea:

If(PRD_CODE='LI',

  If(GRO_PRE>650,'L|1',

  If(GRO_PRE>1250,'L|2',

  If(GRO_PRE>1650,'L|3','Others')))

,PRD_CODE

)

Regards,

Sokkorn