I have a web block that will load if CheckRole.IsDataFetched is true, and doesn't load if false.
The CheckRole data action is set to fetch at start. It's only step is to assign its two output parameters, IsAnalyst and IsFinance, and those are both just role checks, CheckAnalystRole(UserId:) where UserId is an input parameter on the block, and CheckFinanceRole(UserId:). The UserId is set using GetUserId() on the parent screen, so presumably the UserId input parameter should always take a value.
My question is, what is the scenario where CheckRole.IsDataFetched is false? Is there a way to see this in the debugger? If the user is an analyst or is a finance user, the block's main content should NOT load. If the user isn't either of those roles, the main content should load. I can confirm this behavior is executing properly in the app when loaded in the browser.
We're starting to add more roles and I need to add some additional conditions to this and I'm having a hard time understanding how IsDataFetched evaluates and why that would be used instead of the IsAnalyst or IsFinance parameters.
Thanks.
Hi Daniel,
From what I've seen, the IsDataFetched property is generally used for hiding some content (or displaying a placeholder) while waiting for the result of the aggregate. This is often reserved for cases where the Aggregate/Data Action is expected to take long enough to potentially impact UX if not handled correctly. A common example is displaying a spinning wheel while the contents of a table are loading (during the time where IsDataFetched = False).
In your case, my first impression (without the full picture) would be that it probably works as a redundant safeguard to hide UI elements that require special privileges. The variable should be visible as part of the debugger, and in this case you could probably add breakpoints before/after the CheckXRole() actions inside the Data Action to observe the changes.
Hopefully that helps a little.
@Francisco Calderón thanks for the reply. CheckRole.IsDataFetched is the only condition in the If though, and it's hiding content when false.
I also can't see where to see IsDataFetched in the debugger.
Hi @Daniel Johnso
Did you try to debug on after fetch action of check role data action.
There is property in data action which is on after fetch you can bind any screen action inside this property. This screen action mostly run once data fetched by data action
Thanks
Arun
This data action doesn't have an On After Fetch action.
Every data action has on after fetch property.
Can you please share your .oml if possible
I can't share the .oml but here's a screenshot:
Hi @Daniel Johnson
In reactive we can fetch data on scrfeen in two ways -
1. By aggregate2. By Data Action.
in your case you are using data action.
Suppose you have 3 aggregates and 3 data actions on screen so we can't determine which aggregate or actin will run first because they are running asyncronously.
If you have some dependent login on the result of your data action then in this case we can use IsDataFetched property.
Your question in which case it'll be failed ?
- Suppose you have written a piece of code in your action which has errors or exception cuases the process terminated in this case IsDataFetched will be false.
I hope it'll help you.
ThanksDeep
I'm still having trouble with the logic. Here's a screenshot of the entire data action:
It's just one assign step.
Hello,
okay got it, please ensure you are checking role of logged in user, if you pass any other user id which is not logged in Check Role action always give you false.
BTW, your action IsDataFetched property will return true but IsAnalyst and IsFinance will return false only if you'll pass non-logged in user id.
Even you can use check role action without passing any id it'll automatically take logged in user id.
CheckRegisteredRole()
Hi, If this is the case then you need to put extra condition along with IsDataFetched.
Foe example if you want to show a container to user who has Finance or Analyst role so you can set container visible property to -
CheckRole.IsDataFetched AND (CheckRole .IsAnalyst OR CheckRole .IsFinance)
lets change to your data action like this (dont end it)
you can see IsDataFetched false condition,
that means when your data action failed to complete your flow/logic then IsDataFetched =false or
until the flow complete IsDataFetched =false then IsDataFetched =true
@vignesh S thanks for the reply, but I don't want to change anything right now, I'm just trying to understand how CheckRole.IsDataFetched knows if the user is a compliance user. According to the If condition in the widget tree, CheckRole.IsDataFetched evaluates to true when the user is in the compliance role, and CheckRole.IsDataFetched evaluates to false when the user is in the analyst role or the finance role. How is that possible?
add in if CheckRole.IsDataFetched and CheckRole .Isanalyst = roll was analyst