Display a dynamic value from server on the frontend
Question
Application Type
Reactive

Hello,

I am working on an interface screen, that contains several card elements, each element will be displayed to the user depending on a certain condition.  In each element, I need to call a method with sending "id" as a parameter and the method will return a value that I want to display. 

  • it seems I cannot call a server action within my element expression.
  • I only can call a client action of type "Function" and by using Function I cannot call a server action on the client.
  • I don't want to use the "Fetch Data from another source" option, as I need to send a parameter CAW2101170006596 to the action where this option will not be available. 

Based on the above, I need a way to call the server action dynamically and display its value on the client. 

Hi Kawthar,

Without Data Action(Fetch Data from another source) you can not call server action. You can use Block for card elements.

For parameter, You can create input parameter in block and you can use in data action.

Please find the attached sample using block.


Thanks

Vinod

BlockServerActionSample.oml

Hi Ebrahim,

Certainly, you can construct a Data Action (Fetch Data from Another Source) and utilize the local variable to reflect the current selected id inside the data action, and then refresh the data action on demand.

see the below image for your reference..


Thanks @Mayank Dharmpurikar, but I have multiple cards elements each has a different id. For each of them, I want to set a different value for the local variable. how can I achieve that? My second question is whether using the data action from the client will refresh it? or I should call if from the server 

When someone clicks on a card item, for example, if you have a container inside the card, you must trigger the click event of the container and provide the clicked card Id to the Event handler, which will then update the local variable and refresh the data action.

Yes, you can refresh the Aggregates and data actions from the client actions (Screen actions).


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