FinTheHuman Posted February 25, 2019 Report Share Posted February 25, 2019 Hello Guys ! Do anyone of you know a script that eliminates or removed a specific record(s) in a tabular DataPage depending on a condition? Example: Process(Column/field) = "Completed" Then it will hide the whole row/record in that condition. Thank you for your help in advance ! Quote Link to comment Share on other sites More sharing options...
kpcollier Posted February 25, 2019 Report Share Posted February 25, 2019 @FinTheHuman Are you looking solely for JS script to do this? This is possible through table triggers. On an Update Trigger, use a Delete Block and set the conditions. I have this workflow for my ordering/receiving app, once Quantity Received is equal to Quantity Ordered, that record is completed and the trigger deletes it from my table. Quote Link to comment Share on other sites More sharing options...
Aether Posted February 25, 2019 Report Share Posted February 25, 2019 Hey @FinTheHuman, You can try using this code for your Tabular DataPage: <div id="[@cbRecordIndex]"></div> <script> var yourfield = document.getElementById('[@cbRecordIndex]'); if ("[@field:Process]".trim().toLowerCase() == "Completed") yourfield.parentNode.parentNode.style.display = "none"; </script> Add this code inside HTML Block or in the Footer of your DataPage. Make sure the you unchecked the "Enable HTML editor". I hope this helps :) ~WatashiwaJin~ Quote Link to comment Share on other sites More sharing options...
FinTheHuman Posted February 25, 2019 Author Report Share Posted February 25, 2019 @kpcollier, thank you for the suggestion but I don't want to remove the record in my table/Database. Because I just want that condition in my Tabular DataPage and I still need the data/record in some of my DataPage(s). Hey @WatashiwaJin ! thank you for that script, it worked ! Quote Link to comment Share on other sites More sharing options...
IamGroot Posted February 25, 2019 Report Share Posted February 25, 2019 @WatashiwaJin, I also have a similar condition or process for this kind of work-flow but the problem is the output will also depend on the type of user based on my authentication. (For example: If the user is an Employee, I need to hide the record of Inquiry_Type field with a vlaue of "only admin"). Note: I use a Search and Report form (Tabular). I hope you help me with this. Thank you in-advance ! Quote Link to comment Share on other sites More sharing options...
Aether Posted February 25, 2019 Report Share Posted February 25, 2019 Hi @IamGroot, If that is the case then you can try using this script instead: <div id="[@cbRecordIndex]"></div> <script> document.addEventListener('DataPageReady', function (event) { if ("[@authfield:UserType]" == "Employee") { var yourfield = document.getElementById('[@cbRecordIndex]'); if ("[@field:Inquiry_Type]".trim().toLowerCase() == "only admin") yourfield.parentNode.parentNode.style.display = "none"; } }); </script> You can also try this documentation in that kind of process: https://howto.caspio.com/authentications-and-connections/authentication/record-level-security/restrict-access-to-data-by-user-or-role/ I hope this answer your question. ~WatashiwaJin~ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.