× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Thank you Birgitta.

On Fri, Sep 9, 2022 at 2:47 AM Birgitta Hauser <Hauser@xxxxxxxxxxxxxxx>
wrote:

Not sure what exactly you want to get.
Within the JSON data I've neither seen PartNumber, nor AvailableQuantity,
nor Price, nor Message1, nor Message2
You want to get something that is not available, so what do you expect to
get returned?

If you want to decompose the JSON data, you can do it as follows:
select *
from JSON_TABLE('{ "CustomerAccountNumber": 1000171,
"AuthKey": "fjdsklfjdkslfdj",
"Parts": ["924-125"] }',
'$'
Columns("CustomerAccountNumber" Integer,
"AuthKey" VarChar(20),
"Parts" VarChar(20) Path
'$.Parts[0]'
));

It seems to me you want to get the Array Element Data only.
If so you get them as follows:
select *
from JSON_TABLE('{ "CustomerAccountNumber": 1000171,
"AuthKey": "fjdsklfjdkslfdj",
"Parts": ["924-125"] }',
'$'
Columns("Parts" VarChar(20) Path '$.Parts[*]'));


Here is also a link to the JSON Documentation/Examples on Db2 for i:
https://www.ibm.com/docs/en/i/7.5?topic=data-using-json-table

Mit freundlichen Grüßen / Best regards

Birgitta Hauser
Modernization – Education – Consulting on IBM i


"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
„Train people well enough so they can leave, treat them well enough so they
don't want to.“ (Richard Branson)


-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of a4g
atl
Sent: Donnerstag, 8. September 2022 23:13
To: midrange-l@xxxxxxxxxxxxxxxxxx
Subject: Help with JSON_TABLE

First time trying to do this and I have not found a good guide to explain
how this works.

I am trying to get this working. I am running it in ACS's SQL. It runs and
produces a blank screen. I do not see any errors in the joblog.

select q.*

--into :result

from JSON_TABLE('{ "CustomerAccountNumber": 1000171,

"AuthKey": "fjdsklfjdkslfdj",

"Parts": ["924-125"] }',

'lax $.Parts[*]'

Columns(

"PartNumber" char(20),

"AvailableQuantity" char(20),

"Price" char(20),

"Message1" varchar(1000),

"Message2" varchar(1000)

)) as Q

;



Questions:

How does it know what website to contact?


Is it writing to a file or returning a string?


If we request multiple parts, can I do a select into an array?


TIA, Darryl FReinkel.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link:
https://amazon.midrange.com

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2023 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.