This is just a snippet of the code. The JSON build is several screens of code. With the case statement commented out, it builds the JSON file correctly.
Ron Hudson | Programmer / Analyst
+1.704.752.6513 x1324
www.invue.com
-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Bennett, Steve
Sent: Wednesday, May 15, 2019 9:19 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: RE: SQL syntax error with CASE statement
Ron,
1 more try :-) ...... It appears you are missing an end bracket )
'lineItems' value JSON_ARRAYAGG(
CASE when ORPART > ' ' then
JSON_OBJECT(
// CASE when :PST_Exmp = 'true' then
'jurisdictionOverrides'
value JSON_ARRAY(
JSON_OBJECT(
'deductionOverride' value
JSON_OBJECT('exemptOverride' value
JSON_OBJECT('value' value 100)
),
'jurisdictionLevel' value 'PROVINCE'
)
),
// Else
// End
'product' value JSON_OBJECT(
'productClass' value trim(VProdClass),'value' value trim(ORPART)
),
'quantity' value JSON_OBJECT('value' value ORORSH),
'unitPrice' value ORORSL) **** This one here ****
Thanks,
Steve
Steven Bennett
Senior Systems Analyst
AIT Worldwide Logistics, Inc.
Chicago, Illinois, USA
Office: +1 (630)766-8300 / Ext: 6472
Fax: +1 (630) 250-3708
www.aitworldwide.com
our people deliver.®
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Hudson, Ron
Sent: Wednesday, May 15, 2019 8:12 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: RE: SQL syntax error with CASE statement
Thanks, but I tried that. I also tried putting a dummy action in the ELSE.
Ron Hudson | Programmer / Analyst
+1.704.752.6513 x1324
www.invue.com
-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Bennett, Steve
Sent: Wednesday, May 15, 2019 9:09 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: RE: SQL syntax error with CASE statement
Ron,
I believe it's due to you having an ELSE without any action. Try removing that and I think you will be good.
'lineItems' value JSON_ARRAYAGG(
CASE when ORPART > ' ' then
JSON_OBJECT(
// CASE when :PST_Exmp = 'true' then
'jurisdictionOverrides' value JSON_ARRAY(
JSON_OBJECT(
'deductionOverride' value JSON_OBJECT(
'exemptOverride' value JSON_OBJECT(
'value' value 100
)
),
'jurisdictionLevel' value 'PROVINCE'
)
),
// Else
// End
'product' value JSON_OBJECT(
'productClass' value trim(VProdClass),
'value' value trim(ORPART)),
'quantity' value JSON_OBJECT(
'value' value ORORSH),
'unitPrice' value ORORSL
Thanks,
Steve
Steven Bennett
Senior Systems Analyst
AIT Worldwide Logistics, Inc.
Chicago, Illinois, USA
Office: +1 (630)766-8300 / Ext: 6472
Fax: +1 (630) 250-3708
www.aitworldwide.com
our people deliver.®
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Hudson, Ron
Sent: Wednesday, May 15, 2019 8:04 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: SQL syntax error with CASE statement
The code snippet below works with the 2nd case statement commented out. The first case statement works without issues.
With the 2nd case statement uncommented, the next line (below) is highlighted with error "Keyword VALUE not expected. Valid tokens: END".
'jurisdictionOverrides' value JSON_ARRAY( Any ideas?
'lineItems' value JSON_ARRAYAGG(
CASE when ORPART > ' ' then
JSON_OBJECT(
// CASE when :PST_Exmp = 'true' then
'jurisdictionOverrides' value JSON_ARRAY(
JSON_OBJECT(
'deductionOverride' value JSON_OBJECT(
'exemptOverride' value JSON_OBJECT(
'value' value 100
)
),
'jurisdictionLevel' value 'PROVINCE'
)
),
// Else
// End
'product' value JSON_OBJECT(
'productClass' value trim(VProdClass),
'value' value trim(ORPART)),
'quantity' value JSON_OBJECT(
'value' value ORORSH),
'unitPrice' value ORORSL,
Thanks!
Ron
--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
https://amazon.midrange.com
**********************************************************************************************************************
This electronic message transmission contains information from AIT Worldwide Logistics, Inc. and is confidential
and/or legally privileged and shall remain the property of AIT Worldwide Logistics, its subsidiaries, affiliates
and parent companies. The information is intended only for the use by the designated person(s) named above. If you
are not the intended recipient, any disclosure, copying, distribution or use of or any other action or reliance based
on the contents of this information is strictly prohibited. If you received this electronic transmission in error,
please notify the sender listed above.
Global services provided by AIT Worldwide Logistics are subject to the applicable terms and conditions published at
http://www.aitworldwide.com/terms-and-conditions.
**********************************************************************************************************************
As an Amazon Associate we earn from qualifying purchases.