I am trying to convert the windows client customizations to their corresponding web versions via Application Studio.
One customization is disabling the Job Traveler print in the toolbar area if the PersonID is < 101.
So, I did the below, but it isn’t working. Does sysTools relate to the icons in the action section of the header?
Below are screenshots of the data rule and the section of the header I am trying to hide the print button from (Job Entry btw). Thank you for your time!
Have you checked to see if that Dataview is populating with any data when you load the Job Traveler form? Just because the dataview is selectable, it doesn’t mean it is populating with any information.
You can launch a trace in the browser by hitting F12 it slides out a panel to show the debugging window (you can also have it pop out as its own window if you want). Once the screen is launched, go back to the Kinetic screen, and click into a data field. Press Ctrl+Alt+8 to enable debugging mode in the trace window and press Ctrl+Alt+V to show all dataviews. Under the Console tab, you should see all the dataviews on the screen and you can expand them to see what data is available to use.
If the data you are looking for is not there, I create a BAQ and map the BAQ to a dataview, maybe on load of the screen? Find an event that makes sense, run the BAQ, populate the dataview, then do your comparision from that dataview.
Thank you very much for the help! I figured a data rule would “just work” but I am still learning the Kinetic Application Studio process (very new to it).
But you made an excellent point, so I figured instead of trying to use a data rule, I’d use an event.
My thing is, I don’t think I am doing it correctly.
So, I think your action is okay… but your condition may not work.
PersonID is a string. You can try wrapping it in quotes and see if it works on a one-off basis. But your original request of using “less than” may not work as you’re not dealing with a numeric value.
I would be extremely hesitant to compare strings that way.
A much safer bet is to create a small utility function to convert the ID to an integer, send it back and then use that to compare in the rule.
The less-than operator on strings does a lexicographical comparison on the strings. This compares strings in the same way that they would be listed in dictionary order, generalized to work for strings with non-letter characters.
Dictionary order != numerical order.
Example:
Because 2 comes before 7 in “dictionary order”, it’s considered less than 7 even though it’s 22.
Thank you @dcamlin and @itsme! I should have looked at the table to check the data type, fail on my part
That is very true @hmwillett, I can say though I did test the data rule using values of ‘’, ‘035’, ‘102’, and the less than operator on the value using single quotes did work.
I would, however as I come from a C# background, like to implement the function as you described, but I don’t know how to have an event set the value and then check it in the data rule. Do you have a thread out there exampling how to do something like this?
Name these whatever you want:
Create a function library called ‘Utilities.’
Add a function called ‘StrToInt.’
Give it an In parameter of a string such as InStr.
Define and Out parameter of integer such as OutInt.
Maybe include a boolean Out parameter called Success.
Set up the code as such:
Success = int.TryParse(personIDstr, out OutInt);
Promote it.
You can do this in the same trigger you have currently shown.
Include a kinetic-function or erp-function (name is version dependent to add some confusion. ) widget.
Include a row-update widget after your function.
Set a runtime variable like TransView.IntPerCon to {actionResult.OutInt}
Use that TransView.IntPerCon in your rule to compare.
So I liked the Utilities functions, I’ve actually been building function libraries that are extensions of forms (like I built a SalesOrderExt library).
I created a general StrToInt function to be reused, so the naming is a bit different but follows your approach:
I would look at the Dev Tools as this point to check the values of the flow.
Make sure the payload sent to your function has the proper value being sent.
Validate the response is as expected.
Dump the views (CTRL+ALT+V), expand System Views, and validate that actionResult has a value. It may show null here. Assuming you had debugging turned on (CTRL+ALT+8) check the console. You should see some events in there for your row-update showing the values of actionResult at the time.
Thanks, I should have thought to do that. Still getting used to all this, I really appreciate your time today!
The result in the console is rather confusing, I know the PersonID value exists as I had the dialog showing me the value beforehand. From the below, it looks like things are undefined, but yet, actionResult.output is 25, which is the correct value for this record (actual string value in the DB for this record is ‘025’):