Virtual value to be quickly refreshed before the page is loaded

Hi All,

I have a virtual field that displays the current user score (see .gif. Field in blue).

2020-08-06_21-06-14
Note: I cut out from this gif the waiting time for the score to be updated.

Every time the user taps on the Complete button, a record is added in a another table called Class_Card_Logs that stores all exercise cards that have been completed for that session. The expression of the virtual field is using a SUM(SELECT(Class_Card_Logs[Points], filter)). Then the user is redirected right away to another exercise card. The problem is that the virtual field doesn’t have time to load the updated score before the page is loaded. So the user has to wait 5-10s to see the accurate score.

I can’t think of any simple solution that wouldn’t involve changing the architecture (ex: have a table to keep the score in a non-virtual field and showing it via a dashboard while showing the exercise detail view in another window of the dashboard). I could also do a full sync after each exercise completion but that wouldn’t be user friendly.

Has anyone found some alternative to this problem?

Thank you!

What I did was using a SUM(reverse reverence) and another VC for the text with CONCATENATE. I’ve test that using a LOOKUP and it seems that both of them displayed the value before sync is completed.

2 Likes

Awesome!

Can you expand on the SUM(reverse reference)?

Are you suggesting to have 3 separate fields on the same table?

  • SUM(): get the value from the other table
  • CONCATENATE (): build the text to display
  • LOOKUP(): which field do you lookup?

On my case is something like:

SUM([Related OrderDetailTable][Price])

Two VCs: The SUM to calculate the total and the CONCATENATE for the text to be shown on the card view.

If you don’t have a [RelatedITemColumn], you may try with LOOKUP, to look to the SUM column.

2 Likes

No matter how you structure your virtual columns, they will not update until either a sync occurs or the row containing the virtual column value is updated in some (non-virtual) way. Trying to force a sync is–as you’ve noted–not user-friendly. Instead, consider making a trivial benign change to the row you’re sending the user to in order to prompt the virtual column to update. You may want to add a normal (non-virtual) column for this very purpose. You could also instead consider making the existing virtual column a column of type Show and use its Content property to provide real-time values. The downside is that Show columns don’t format well in detail views.

3 Likes

@Heru In my case I don’t have a direct relationship to do a reverse reference but thanks I’ll keep this in mind. I tried to use a LOOKUP on a table where the score is updated but the same scenario occurs.

@Steve

You may want to add a normal (non-virtual) column for this very purpose

Yeah, I can’t have this field on the current table. I do update the score on another table ‘Class_Logs’. Querying it via the virtual fields gives the same result.

You could also instead consider making the existing virtual column a column of type Show

I converted the virtual field into a Show column but it also gives the same result.

The only option I see right now is to have the Class Log table at the top of a dashboard so the score can be displayed and the current view at the bottom of this dashboard. It’s a major change on my hand and the format wouldn’t be as nice as right now.

the row containing the virtual column value is updated in some (non-virtual) way

Is there another option to do that?

Thank you!

That’s odd. Did you use a Content expression as I suggested?

Nothing other than the option I’ve already given.

1 Like

Did you use a Content expression as I suggested?

I added this following code into the Content field.

CONCATENATE(
    	[Fast Class Completed Cards Count]
    ,
    	" completed"
    ,
    	" ("
    ,
    	[Fast Class Points Collected]
    ,
    	IF([Fast Class Points Collected]>1, " points)", " point)")
    )

2 Likes

It’s using the virtual column we’ve already established won’t be updated, so of course it’s going to have the same problem. Try computing the counts in the Content expression.

2 Likes

Thanks Steve. That works great!
Why can’t we have the same behavior in non Show type field? I can’t referred to the Show field content from another virtual field right?

I don’t know. :frowning:

Correct.

1 Like

To share, this is with action+1:

and this is with the sum:

2 Likes

I think the LOOKUP works in this case because it is the same record.