I may be trying to do something that just isn’t possible…
I have a Data View that is populated during a GetByID_OnSuccess
after event. I use this Data View to populate a custom grid on a new tab on their Job Entry form to show DMRs tied to the job.
Besides showing the data, they want a flag to note if there are open DMRs. My hope was, like I did in the E10 custom code, I could re-use this data view, and simply get a count of records in it where it’s Calculated_IsOpenDMR column has values of ‘Y’.
I tried the below expressions and I listed the errors.
%OpenDMRsForJobDV.filter(m => m.Calculated_IsOpenDMR == 'Y').length%
- SyntaxError: Unexpected token '%'
I got this idea using the post: Get count of a DataView rows in a Grid in Application Studio - Kinetic ERP - Epicor User Help Forum
I then found the below posts:
String replace (or other string functions) in application studio - Kinetic ERP - Epicor User Help Forum
Row-update expression formats? - Kinetic ERP - Epicor User Help Forum
And tried the below to no avail…
"{OpenDMRsForJobDV}".filter(m => m.Calculated_IsOpenDMR == 'Y').length
- function body "{OpenDMRsForJobDV}".filter(m => m.Calculated_IsOpenDMR == 'Y').length thrown exception TypeError: "{OpenDMRsForJobDV}".filter is not a function
"{OpenDMRsForJobDV}".data.filter(m => m.Calculated_IsOpenDMR == 'Y').length
- function body "{OpenDMRsForJobDV}".data.filter(m => m.Calculated_IsOpenDMR == 'Y').length thrown exception TypeError: Cannot read properties of undefined (reading 'filter')
I figured worst case I could build a function library to check the values.
– UPDATE: I ended up creating two Data Views, one for all records and the other that only contains the records where IsOpenDMR = ‘Y’. Not ideal as I hit the BAQ twice, but it works. Still would love any thoughts on the JavaScript approach. Thanks!
Any thoughts would be greatly appreciated, thank you!!