I have a more complicated example similar to this and it’s not behaving as I would expect. Here is the jsFiddle to help reproduce the problem.
I’m using “vue-flexmonster”: “^2.9.6”.
To reproduce the problem:
Click on Cell 4,4 –> the header shows two IDs. This is correct.
Click on cell 5,2 which contains a distinctCount = 1 –> returns six IDs which is not correct. I’m expecting one.
There are other cells that behave similar to 5,2. What do I need to change so I get the correct IDs?
Thanks in advance!
Thank you for posting your question.
Please note that the 5,2 cell in the JSFiddle sample you’ve provided is a total – it consists of all the records that include the fields the “Finished” calculated value relies on.
recordId property of the Cell Data object stores all the ids of all the records used to compose a cell, which is why in the total, you get the ids of all the records, even if some of them contribute zeroes to the total value.
Please let us know if this clears up the behavior of the component.
Ah ok, makes logical sense. However, since 5,2 uses a formula to calculate the label, I need to get the IDs from the formula output for that cell. Is this possible?
formula: 'if(\'hoursToComplete\' < 4 and \'Report Signed\' == 1, distinctcount("medicalStudyId"), )',
The use case is that I’m counting the number of incomplete studies into timeframe columns. When the user clicks the cell, I need to populate the worklist with those studies.
Thank you for your response.
Because of the reasons described in my previous message, it is impossible not to store all record ids in a totals cell.
Unless, for example, you filter the “Location/Lab/User” hierarchy by a single member, meaning the totals cell value will replicate the value of that member.
Feel free to reach out if there is anything else we can help you with!
Thanks Mykhailo. I’d like to make a feature request that if a cell is filtered, values from the filter would be available in a prop. I had to write a duplicative js function when the cell is clicked to filter the IDs when I click on them to give me filtered ids. Or another possible idea is if I could pass a js function to the formula property, then I could reuse it rather than having to write the flexmonster syntax and a js function.
Our roadmap is full at the moment, so we cannot provide you with any realistic estimations on whether this feature is feasible to implement in the near future.
Still, we have taken your suggestion into consideration, and we’ll make sure to inform you if anything changes on this matter.
In the meantime, if we understand you correctly and you have found a valid workaround, we’d suggest using it for now.