For partners that build or integrate commercially available applications and service solutions with the Oracle Cloud Platform
For partners that provide implementation or managed services around Oracle Cloud Applications
Hi,
I am calling a service and populating my ADP with response data using assign variable. How do i check if the ADP is empty or contains rows of data?
Comment
In your action chain you'll have an assign variable action.
Look at your browser's console to locate that action and it will show you the value in your ADP after the assignment -
https://blogs.oracle.com/vbcs/debugging-and-troubleshooting-visual-builder-logic
Be the first to rate this
|
Sign in to rate this
Hi Shay,
Thanks for the response. But i want to check if my ADP has any row or not using if condition in the action chain. Based on that i want to show message on the UI.
Be the first to rate this
|
Sign in to rate this
Check the length of the data[] array in the ADP and whether it is bigger than 0.
Be the first to rate this
|
Sign in to rate this
Hi,
I tried {{ $page.variables.MyADP.data[] > 0 }} in if condition . But Its returning false even though my ADP has 3 records .
Be the first to rate this
|
Sign in to rate this
Does it work if you add .length - $page.variables.MyADP.data[].length > 0
Be the first to rate this
|
Sign in to rate this
No Shay :(
Be the first to rate this
|
Sign in to rate this
This works for me - [[ $flow.variables.FEmpADP.data.length > 0 ]]
Be the first to rate this
|
Sign in to rate this
Hi Shay,
if i try[[ $flow.variables.MyADP.data.length > 0 ]] , if condition does not get evaluated at all. It's giving neither true nor false
if i try {{ $page.variables.MyADP.data.length > 0 }}, condition always gets evaluated to true, even if ADP does not have any record.
Be the first to rate this
|
Sign in to rate this
If you use a notification action and output the value of $page.variables.MyADP.data.length in it - what value do you see it having when the ADP is empty?
Be the first to rate this
|
Sign in to rate this
Hi Shay,
It's working perfectly fine in notification as well as in if condition {{ $page.variables.MyADP.data.length > 0 }}. I do not know what mistake i was making earlier that if condition was not getting evaluated properly.
Thank you so much for your replies.
Be the first to rate this
|
Sign in to rate this
Shay - does this technique still work after the latest VBCS upgrade? It seems we get an error where the ADP Id Attribute is being evaluated before the length function occurs.
when we simply do a notification action for something like below
$page.variables.txnRevOTTMainADP.data.length
We get an error like this, where RevnId is the Id attribute.
VB (ERROR), /vb/action/action]: Action fireNotification1_e468xzvh6 failed. TypeError: Cannot read property 'RevnId' of null
at SinglePropertyIdAttributeHelper.getKey (dataProviderUtils.js:116)
at dataProviderUtils.js:120
at Array.map (<anonymous>)
at SinglePropertyIdAttributeHelper.getKeys (dataProviderUtils.js:120)
at Function.buildDeltaItemKeys (jsonDiffer.js:113)
at jsonDiffer.js:56
at Array.forEach (<anonymous>)
at JsonDiffer.processDeltas (jsonDiffer.js:48)
at ArrayDataProvider.get [as data] (arrayDataProvider.js:568)
at eval (eval at createFromString (expression.js:78), <anonymous>:3:416)
Be the first to rate this
|
Sign in to rate this
Seems to work fine for me in 19.3.1 too.
Be the first to rate this
|
Sign in to rate this
Hmm? It is broke across our entire app using. I guess we have to create a SR.
Be the first to rate this
|
Sign in to rate this
Just to verify the steps you take are:
1. Execute REST call
2. Take the REST results and assign them to the data[] part of your ADP
3. Reference your ADP.data.length
Or are you doing another step somewhere?
Be the first to rate this
|
Sign in to rate this
This is not working for me also in version 19.3.1.2.
Any solution ?
Be the first to rate this
|
Sign in to rate this
Since this seems to work for me and I can't reproduce the issue on my side, we'll need to get your reproducible test case to see what is wrong. Either attach it here or better even open a service request with Oracle Support and provide it there.
Be the first to rate this
|
Sign in to rate this
Ok, the issue is checking if ADP has data in bind-if component (not in action chain)
Be the first to rate this
|
Sign in to rate this
This works for me in 19.3.1:
<oj-bind-if test="[[ $variables.empADP.data.length ]]">
<oj-table scroll-policy="loadMoreOnScroll" id="oj-table--1782984506-1" data="[[ $variables.empADP ]]" columns='[{"headerText":"id","field":"id"},{"headerText":"name","field":"name"},{"headerText":"email","field":"email"},{"headerText":"salary","field":"salary"}]'></oj-table>
</oj-bind-if>
Be the first to rate this
|
Sign in to rate this