Skip to main content

Implement While loop in XSLT of OICS

Introduction:

In the XSLT mapper of OICS by default we don't have the while loop to implement, but there can be a situation where we need to implement while , when such situation shows up how to implement it?

Main Article:



In the above XML, the filename is static....say we need to populate the same field with 5 file names in a single shot in other words to bring dynamism to the Code we have to use loop.

Lets do it using While loop.

But in XSLT we don't have while loop by default, then how can we achieve this?

Just like functions in any other languages we have a thing called 'Template' in XML. Using this we can achieve the while loop.




1) In the above code, match='/'  indicates the default template to be called , In this case the default templated calls the 'customWhile' template which we had created with parameter 1 as the input.

2) Once the template is called in the very first step as check would be performed to check the input param falls in our desired limit or not?

3) Once it passes the check a new filename would be generated.

4) Post that we are incrementing the input parameter and we are calling the same 'customWhile' in a recursive manner.

5)Hence this time the input value becomes '2' .

6) The steps 2,3,4 gets repeated again.

7) Once the loop reaches its limit (<6 in this case) it breaks and shows the message as 'loop has ended!'


The output of the above logic looks like:






That's it Congratulations you had successfully overcome the XML limitations by creating a While loop of your own.



-Preetham Konjeti









Comments

Popular posts from this blog

Convert App based Integration to Scheduled Integration without wrapper in OICS

we all know that converting a scheduler integration to REST is quite easy , where as the reverse is not possible and the only way to achieve it is through creating a wrapper scheduler integration and invoking the trigger one as child from there. But there is another way through which we can achieve the direct conversion. For that please refer to below example. Note : Every step mentioned has to be done very carefully Create Scheduler Integration. I’ve created a base one in which it invokes a SOAP service.  I’ve created a small trigger integration which I’m going to change to scheduler without any wrapper. Please follow the below steps to convert rest based to scheduler:     1)    Export the integration.     2) Rename the iar file to zip.     3) Now unzip the file.     4)    Compare the properties files of both scheduler and rest based integration and make the changes to rest based as per the scheduler integration After changes Now open the resources folder: Move the scheduler resour

ChatGpt X Oracle Digital Assistant Integration

  Introduction In this article I will be explaining about integrating the ChatGpt with Oracle Digital Assistant. NOTE : This is not a suggestion to have ChatGPT in your ODA, this article is just to showcase the flexibility of the ODA to easily integrate with anything. Main article ChatGPT ChatGPT is an AI language model developed by OpenAI, capable of processing natural language input from users and generating coherent and relevant responses. It has been trained on an enormous corpus of text data using unsupervised learning, allowing it to generate responses that are not just grammatically correct, but also contextually appropriate and engaging. ChatGPT is particularly useful in scenarios where there is a need for rapid and accurate responses to user queries, such as in customer service or personal assistants. However, it may struggle to generate appropriate responses in certain situations and may not be suitable for scenarios requiring a high degree of personalization or cus

Backup Integrations of an Instance with a single click using OIC

  Introduction One common mistake that most of OICS developers make is not taking the backup of their integrations religiously and if they want to take backups clicking on the export of the integrations individually could be quite tedious. Main Article In this blog I will be explaining about automating the backup process in OICS. Below is the order of the steps that are to be followed: STEP:1 1) Configure a Rest trigger connection as shown below. Provide the below payload in the request section:     {   "IntegrationName”: "" } STEP:2   Configure the new rest connection as mentioned below. (This basically list downs all the integration details as per the provided name).   Provide the Query parameters as below:   Provide the response payload as below: {   "hasMore" : "false",   "items" : [ {     "id" : "",     "name" : "",     "lockedFlag" : &quo