Data missing in nested web block on Ajax Refresh
Application Type
Traditional Web
Service Studio Version
11.12.3 (Build 50494)
Platform Version
11.13.0 (Build 31107)

Hi everyone,


We have created a web screen that contains a web block that displays an order header list.

Within that order header list (so within the web block), we use another web block that displays the order items for each order in the list.

In both web blocks, the list contents are stored as a local variable which are filled in the Preparation, the first time the block is started.

What we want to do is highlight matching order items based on a value that is set in the Web Screen. 


When we trigger an Ajax refresh of the order list web block (by clicking the Highlight button), the local data of the order list remains available and the value that is passed in from the screen is also available.

But that is not the case for the order item web block. We do receive the input from the web screen, via the order header web block, but the item data in the local variable in the order item web block is completely gone.


Does anyone have a clue how we can keep the data in the item web blocks view state so that we do not have to retrieve the data again with every ajax refresh?

I have added a screenshot of the screen for reference.


We are looking forward to your possible solutions!


Jos

Screen layout.JPG

Hello Jos van Hinsberg,

I think I have solved your issue. You can test here:

https://personal-gxzlvs5j.outsystemscloud.com/OrderList/Entry1.aspx

I also send in attach the OML.

Best Regards,

Nuno R

OrderList.oml

Hello Jos van Hinsberg,

Is always better to provide an OML that the other developer, can try to understand the issue better.

Your explanation is very good. I will try to see if I can understand what is happen.

Best Regards,

Nuno R

Hi Nuno,

Please find the example OML attached.

Since we are retrieving external data in both webblocks, I added some comments in both preparations.

I hope this helps you understand the issue we are facing.


The local variable in OrderOverview_WB still contains data when we press Highlight, but the local variable in the child webblock (OrderItem_WB) is empty.


Best regards,

Jos

OrderList.oml

Hello Jos van Hinsberg,

I think I have solved your issue. You can test here:

https://personal-gxzlvs5j.outsystemscloud.com/OrderList/Entry1.aspx

I also send in attach the OML.

Best Regards,

Nuno R

OrderList.oml

Hi Nuno,


Thanks for working with us on this one!

I will need to re-fetch with each refresh as you are also doing.

Would have loved to avoid these additional calls to the originating system, but that's the unfortunate result of the decision to go for Traditional Web... and having to show a list...


Thanks and Best regards,

Jos

Hello Jos van Hinsberg

I think with Traditional Web is the only way.

I was glad to help.

Best Regards,

Nuno R

Hi Jos,

your problem is not related to it being more than 1 webblock down, but to it being part of a list.

See attached oml, any local variable in a webblock that is inside a list, looses its value when the list or any container above the list is being Ajax refreshed.  This is regardless of whether the webblock is directly in a screen or some level lower.

When the same webblock is not inside a list, the value is retained, even if it is nested.  I don't know the rationale behind this, it's probably not a purpose of the design but an accidental side effect.  

I vaguely remember from the online learning, something like at the end of each preparation, the aggregate (or local) list gets copied to the widget list.  I could imagine they implemented that as clearing the widget list and then appending items from the aggregate or local list it is bound to.  And as the webblock is inside the list, this causes all webblock instances in the list being deleted, and new instances being created, and of course these new instances can't remember values that were known by the thrown away blocks.  You can see this in the demo oml because there is only one log of the preparation being executed for webblocks inside a list, but multiple logs for webblocks outside of lists.

Dorine

QDT_RefreshBlockWithVariable.oml

Hi Dorine,


Thanks for the response and explanation.

This confirms what we were already experiencing.

Will have to implement it slightly different to be able to re-fetch the data with each refresh.


Thanks for checking and confirming!

Jos

i think indeed refetching is recommended anyway over passing too much data back and forth over the viewstate (of course depending on what fetching means, a quick query on an indexed field in the database is more obvious than an expensive call over a remote api)

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.