Trouble with an expression I already wrote but lost - COUNT function?

Hey guys,

So I just regenerated one of my tables after a season of the app running smoothly, and I just lost one of my app expressions (actually a couple, but they all kind of function the same) that generated some info for me. No idea why it was lost - can someone please explain this to me so it doesnโ€™t happen again???

My expression is this:

CONCATENATE((COUNT(SELECT(Timesheets[_THISROW], [Client Name] = [_THISROW]))), " OF โ€œ, [# of Visits], " VISITSโ€)

It verifies, etc. but doesnโ€™t give me the answer I want it to give (and that is has given in the past).

Basically, I want appsheet to count the number of entries (ie. rows) in a given spreadsheet, that are assigned to a certain client. And then I want the answer displayed in the app like this:

โ€œ12 of 20 visitsโ€

So as we make visits, the number of visits is tallied and we can see how many we have left.

So I am in a client info spreadsheet list, and I want the app to say we have made X number of visits out of the assigned 20 or whatever. This information is coming from another spreadsheet, titled Timesheets. It is linked via Client Name to the Client Info spreadsheet I am working off of. (The Timesheet spreadsheet lists a Client with each entry that is a Ref to the Client Name on the original spreadsheet.)

Each visit to the client has a new row in the Timesheet spreadsheet. So I just need it to count the number of rows, not a number in the column. And I need to filter it to just count the number of rows designated to that client.

The second part of it works (the 20 hours part).

But I"m having trouble getting it to add up the # of visits we have made thus far.

Please help - donโ€™t know why it was working and then suddenly doesnโ€™t work at all.
Many thanks!
Miranda

0 7 159
7 REPLIES 7

Having a similar issue with another expression that has worked in the past:

SUM(SELECT(Design Numbers Reorganization Table[Planting Only Price], [Client Name] = [_THISROW].[Client Name]))

It seems that the de-ref using the Client Name isnโ€™t working. Thoughts??

Generally, that shouldnโ€™t happen. Had you made significant changes to the column structure of the regenerated sheet, like multiple name changes. That might have caused Appsheet to โ€œlose trackโ€ of which column was which, and thus would have defaulted some of the column definitions. Thatโ€™s just a guess.

If you have a Ref column like this, then you should also have a Virtual column in the Clients table called โ€œRelated Timesheetsโ€ (or similar). Your expression can be greatly simplified. Try something like this:

COUNT( [Related Timesheets] ) & " OF " & [# of visits]

Is this a similar structure as above, with a Ref column, and a โ€œRelatedโ€ฆโ€ VC?

Steve
Platinum 4
Platinum 4

If an Initial value expression references a column that is removed or renamed as part of a column regenerate, the Initial value expression will be removed. There may be other column expressions similarly affected, but this is the one that gets me all the time. Iโ€™ve reported it internally several times, but havenโ€™t seen a fix.

Steve
Platinum 4
Platinum 4

I wouldnโ€™t expect Timesheets[_THISROW] to work. Perhaps you mean Timesheets[_ROWNUMBER]?

Hi all!! So, by accident, the Key Column [Client Name] type had been changed to Enum instead of Text. Once I fixed that, literally all the problems went away, thank god!!

Thank you for all your help!!

Any way to prevent it from changing something like that in the future?? If I have to regenerate?

By someone editing the app configuration? Or by the app editor itself (such as during a regenerate)?

I accidentally erased the column header [Client Name] and then when I figured that out, I typed the correct thing back into the app and Regenerated the Table, thatโ€™s when everything went wonky.

Top Labels in this Space