How To: Kinetic Row Rule Functions

***This feature has been removed in 2023.1+ :frowning: ***


This one is a pretty short tutorial, but has the potential to allow for greater control over the rules you use in App Studio.

You can use JavaScript functions and expressions to do more complex Row Rules in App Studio, however, they are a tad finicky in their current iteration, so it may take some playing in order to get it to time just right.

Row Rules fire initially on form load, so you need to check for undefined in order for it to not blow up when the screen loads.
YourColumn === undefined or YourColumn !== undefined

The syntax would be:

return ( <Null Check> || <Expression or Function> )

return (ABCCode === undefined || ABCCode.includes('A'))

4 Likes

So how do we get around base or ‘Locked’ Rules?
For instance, in MES > End Downtime the Note field is disabled by a Locked Row Rule.
In classic I used a Row Rule to reset it’s Style to ‘Default’ which allowed Note Update while Ending Downtime. In classic it looks like they used a UIPermissions function or something to prevent entry and a Row Rule allowed me to override, but in Kinetic there’s already a row rule and it’s locked. I tried copying it and enabling the field but that doesn’t seem to work, I guess the execution order isn’t what I expected.

Well, this is hacky as all get-out, but it works? LOL…
They really stonewalled me throughout with their locked stuff.

Create a layer in the Downtime Entry screen, then add an event for AfterInitialize and use a row-update widget to set the TransView.Mode field to something–anything really.

Open the native MESControl.EndDowntime event and select the app-open widget and view the properties. Right-click the Layer property and click inspect.

image

Expand the nodes and delete the highlighted:

This should open the field and allow you to enter the name of your Downtime Entry layer.
Save.

Aaaaand hacky magic:

Downtime

1 Like

I should mention that this is likely not “upgrade friendly”.

¯\_(ツ)_/¯

1 Like

Wow and yuck, but I’ll take it… I guess we will see how well it upgrades.
Thanks!!!

1 Like

Sorry, I’m stuck!

I have a BAQ that returns the number of documents of a particular type (“site safety docs”) for a given customer, linked to a dataview in customer entry. Its updating the dataview ok.
Most customers don’t have site safety docs so no rows are returned, so the null check should return true, and disable the linked control.
Some customers do have these docs, and the one I am looking at below has 1.
(CW_SafetyDocs.Calculated_SiteSafetyDocCount is 1)

I did a javascritpt thing as you decsribed, using
return(Calculated_SiteSafetyDocCount === undefined || Calculated_SiteSafetyDocCount == 0):

(UPDATED and simplified below)

but when I look at what’s happening, thre function seems to be evaluating true, even though Calculated_SiteSafetyDocCount is 1:
image

the dataview CW_safetyDocs:

(It is returning true as expected for customer with no safety docs, ie where dataview CW_SafetyDocs is empty, but can’t see why its true in the above case)

UPDATE I simplified it so the consdition was simply return(Calculated_SiteSafetyDocCount === undefined )

as the rows are only populated if the count is >0 anyway.
Still always returns true; I’m missing the point here somewhere…

For me check for undefined was always returning true. Even if field was populated and I was able to see value on the screen.

Is there any way to check in Data Rules if my table is having at least one row?

@hmwillett is there a way to do this in 2023.2?

Soon.

2 Likes

thanks well im going to go and vote for that lol