Skip to main content
Solved

Convert PL/SQL record to JSON in Custom Projection

  • February 14, 2024
  • 3 replies
  • 345 views

Forum|alt.badge.img+7
  • Sidekick (Partner)
  • 18 replies

Hi,

We have implemented various custom projections and have a customer requirement to store the request and response payloads into a custom log table. Some payloads can be quite large so we have set these table fields to be of CLOB type.

Is there an easy way to convert the request and response payloads (which are of pl/sql record type) into a JSON CLOB format? Currently the only way we know of is to create the JSON from scratch using the values retrieved from the payloads. Is there some sort of utility, package or some other method that can be used to easily do the conversion?

Thanks!

Best answer by dsj

Hi @mtoca 

When you are defining the structures in your projection, add ReadAndWrapWithJson property as mentioned here

Index - Technical Documentation For IFS Cloud

structure Expose using MyEntity {
   nestedwithcrud = ReadAndWrapWithJson, ReadAndWrapWithXml, Create;
}

Then code generator will add the methods to convert to Json/XML

I have not used these myself for your kind of a requirement but I see the generated methods in my code ;)

 

 

It inputs the PLSQL array and outputs Json_Object_T

I’m entirely not sure how these methods are used by the framework  but I hope you can use them for your need.

 

Hope it helps!

Damith

View original
Did this topic help you find an answer to your question?

3 replies

dsj
Ultimate Hero (Partner)
Forum|alt.badge.img+22
  • Ultimate Hero (Partner)
  • 861 replies
  • Answer
  • February 14, 2024

Hi @mtoca 

When you are defining the structures in your projection, add ReadAndWrapWithJson property as mentioned here

Index - Technical Documentation For IFS Cloud

structure Expose using MyEntity {
   nestedwithcrud = ReadAndWrapWithJson, ReadAndWrapWithXml, Create;
}

Then code generator will add the methods to convert to Json/XML

I have not used these myself for your kind of a requirement but I see the generated methods in my code ;)

 

 

It inputs the PLSQL array and outputs Json_Object_T

I’m entirely not sure how these methods are used by the framework  but I hope you can use them for your need.

 

Hope it helps!

Damith


Forum|alt.badge.img+7
  • Author
  • Sidekick (Partner)
  • 18 replies
  • February 15, 2024

@dsj You are a savior. This works! Thanks so much!


MizanulIslam
Sidekick (Partner)
Forum|alt.badge.img+7
  • Sidekick (Partner)
  • 34 replies
  • February 15, 2024

@dsj Thanks Damit… You are really a IFS super hero 😎


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings