New Bug Encountered: Counter gets back its initial value

Hi All,

I build a counter that shows the number of card and time left (see on the top left of the gif)

It works great but when I wait a bit, the counter gets automatically reinitialized for no reason. I canโ€™t figure why. Since this class has very few exercises, the class duration is only 1 minute. For bigger class, the same issue occurs for the time left.

Here are the field definitions:

The counter field is called โ€œFormatted Summary Class In Progressโ€.

  • Type: Text
  • Expression:
    COUNT([Class Cards])-[Cards Completed] & " card left" & " โ€ข " & [Formatted_Duration_Left] & " left "

[Class Cards]:

  • Type: List
  • Expression: REF_ROWS(โ€œClass_Cardsโ€, โ€œClass_Boardโ€)

[Cards Completed]:

  • Type: Number
  • Expression:
    COUNT(
    SELECT(
    Class_Card_Logs[Key]
    ,
    [Class_Log]=INDEX(SELECT(Class_Logs[Key], AND(NOT([Fast Class]), [Device]=CONTEXT(โ€œDeviceโ€), [Status]=โ€œIn Progressโ€)), 1)
    )
    )

[Formatted_Duration_Left]

  • Type: Text
  • Expression:
    ROUND(TOTALMINUTES(SUM(SELECT(Class_Cards[Duration], IN([Key],[_THISROW].[Class Cards In Progress])))))& " mins"

Thank you!

0 17 304
17 REPLIES 17

Any help on that?

I donโ€™t know if it is a normal approach, however what I did for card view is having a separate VC just for doing calculation and another VC for doing the text with app formula CONCATENATE("Blabla", [CalcVC]).

got it. Will try that and get back to you.

One more thing you may wish to consider is that in the expression

COUNT([Class Cards])-[Cards Completed]

to show number of cards left, the part COUNT([Class Cards]) seems to remain intact because the โ€œcards leftโ€ number resets to the orginal highest number that comes from [Class Cards] column.

So the column [Cards Completed] seems to reset back to zero.

Thus if you are testing the expression in the emulator, I believe the CONTEXT(โ€œDeviceโ€) used in the expression of the column [Cards Completed] could be creating an issue.

I suggest you test the expression on a mobile device. This is so because in the emulator, following behavior of the CONTEXT('Device") expression is mentioned. So in emulator testing the device UUID could restting the value of [Cards Completed] to zero.

Quote from the article: In the emulator of the app editor, the value is randomly generated each time the editor is loaded or changes are saved.

Thanks @Suvrutt_Gurjar but I have seen the bug happening on the mobile app as well

Oh, ok, thank you for the update @teambelair.

In general, since it is the second part of expression that seems to be failing, it may be good idea to to test by eliminating each of the subexpression parts, starting with CONTEXT(โ€œDeviceโ€)

Can the expression be tested without CONTEXT(โ€œDeviceโ€)?

You are right. I updated the expression of [Cards Completed] by removing the CONTEXT(โ€œDeviceโ€) and it works fine. The counter doesnโ€™t get reset.

COUNT(
SELECT(
Class_Card_Logs[Key]
,
[Class_Log]="Hardcoded_key"
)
)

Whatโ€™s the best way to share this bug with appsheet?

I canโ€™t think of any workaround since I have to use CONTEXT(โ€œdeviceโ€) to identify the current user session.

Nice to know that the issue is now known.

Well, I believe the CONTEXT() functions in general , as the name suggests, work for that particular CONTEXT(), either a view or view type or device. So those need to be used with that understanding.

So it may not be a bug but possibly a particular condition during which the CONTEXT() function is not applicable and thus the expression fails.

You may write to support@appsheet.com for guidance. or you may start a new post thread by stating the exact problem ( now identified with CONTEXT(โ€œDeviceโ€) ) so that some community colleague could share insights.

Thanks, I sent an email to the appsheet support.

During my testing, it seems that the CONTEXT(โ€œDeviceโ€) is โ€œstableโ€ when utilize it with a Security filter. The Chrome utilized is with a dedicated profile on a session, even when closing all tabs, shutdown and re-open chrome to re-open the test app, it still showing the intended record per the CONTEXT(โ€œDeviceโ€) that is specified.

I am on the PUBLISHER_PRO plan so I donโ€™t have access to the Security filter. Iโ€™m adding my filter in the Row filter condition of the slices.

@teambelair, Could you update if you are running the app in browser in mobile device or have you installed it in the mobile where you are testing it?

Edit: You may wish to check above because โ€œDeviceโ€ as a host seems to be working when the app is installed in the mobile.

Below are excerpts from the article -
Host : Gives Browser if the app is running in a browser or the app editorโ€™s emulator, Device if a native app, or Server if used from an AppSheet server (e.g., in a workflow or report).

So you may wish to include iexpression something like below and test with the app insalled on the mobile device.
AND( CONTEXT(โ€œHostโ€)=โ€œDeviceโ€ , CONTEXT(โ€œDeviceโ€)=[Device])

Note : The above suggestion is untested.

The app is mostly run on the whitelabel mobile app. I say mostly because power users do use it on web browser as well but the priority is on the app.

Also CONTEXT(โ€œdeviceโ€) is working fine. Itโ€™s just not working in this particular case where a virtual column calls a SELECT with CONTEXT(โ€œdeviceโ€) as a filter.

If:

Have your tried to split with a new VC:

SELECT(Class_Logs[Key], 
		AND(
			NOT([Fast Class]),
			[Device]=CONTEXT(โ€œDeviceโ€),
			[Status]=โ€œIn Progressโ€)
		)

And the COUNT:

COUNT(FILTER("Class_Card_Logs",[Class_Log]=INDEX([NewVC]), 1))

Ok, thank you for the updates @teambelair.

I have no further discussion points to share on this topic. I will definitely share if I am able to create similar test conditions and I find any useful observations to share.

Thanks @Heru. That is a useful input. I believe it shall be useful to the community while testing CONTEXT(โ€œDeviceโ€).
I believe your tip is worth sharing in Tips and Tricks section. You may wish to do that.

Top Labels in this Space