vshivanna Super Contributor.
Super Contributor.
126 views

Filter SQL data for more than 30 columns

Hi team,

 

I am trying to fetch results from SQL using Select query in HP OO. There are more than 30 columns in the SQL. I need to pass all the columns values to different operations. So I am filtering by separting a new line and selecting the line.

 

Attached the screenshot...

 

If columns are added in the middle of the table in SQL, then we have a problem, values will be changed. Again need to filter almost all the columns..

 

Is there any better way to do..?

 

Can we filter data via SQL column names..?

 

And also can we do something via XML for this...?

 

 

Regards,

Soundarajan K.

 

 

Labels (1)
0 Likes
2 Replies
Absent Member.. Sussan_Z_OO Absent Member..
Absent Member..

Re: Filter SQL data for more than 30 columns

Hello Soundarajan,

I am an Operations Orchestration Support representative, I will be researching according to your questions.

Please give me a bit more time and I will be back as soon as possible.

 

Thanks for your understanding.

Sussan Zamora

HPOO

“Regards,
If you find this or any post useful to resolve the issue, please mark this thread as correct answer and other members can benefit with the information given
Sussan Zamora
SW Support Technical Consultant
San Jose, Costa Rica
hpe.com
Hewlett Packard Enterprise “
0 Likes
Absent Member.. Steve_Drummond Absent Member..
Absent Member..

Re: Filter SQL data for more than 30 columns

For these kinds of queries I ended up converting my SQL header row and results into JSON objects. You can then iterate the JSON array and convert the properties to flow vars.

 

For example, your JSON object might look like this

 

[
{"user_name":"testuser", "rejection_reason":"because"},
{"user_name":"anotheruser", "rejection_reason":"science"},
...
{"<column_name>":"<column_value>", ..} ]

You can either append the SQL Next Result as you go, or do the entire result in one scriptlet step.

 

I built a utility flow here that executes a desired query and returns either CSV results or JSON results depending on if the input "createObjects" is set to true.

 

Hope that helps.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.