App Studio Data Rules - List?

I’m slowly getting my head around Application Studio, and am currently exploring Data Rules.

On Sales Order Entry, I’m trying to create a data rule where if the CustNum is one from a short list, and the PONum field is empty, highlight the PONum field in red.

I can get it done for a singular custnum, but when I start trying to add multiples with OR statements it gets itself into a mess with groupings that seem to break the flow and functionality.

Is there a simple way of telling it to look at a defined list of customers, or am I better off making individual rules for each custnum, which would be a pain, but not the end of the world?

1 Like

You should be able to make a group of customers where the conditions are joined by “ORs” and then add in the PONum outside of that group connected to the group with an AND. Did you try that?

1 Like

Yeah, this is a pain. Here’s my suggested work around.

Yes, this is the path I would take!

I’m not sure how you’re compiling your list of CustNums… but if you can store that list value in a dataview.column, you can then combine an event and a Data Rule to do what you want.

~*~

Here’s a quick example… I used PartNum instead of CustNum, but that doesn’t matter:

I set my trigger to be based off my target column changing value, so it is evaluated each time. column_changed

My first row-update creates my list. In my case, I just added it manually.

The JSON is just a couple part numbers surrounded by tildes.
image

Next is my Condition:

Expression: '{TransView.MyFilterList}'.includes("~" + '{TransView.PartNum}' + "~")

So, if my filter list includes “~” + “{my TransView.PartNum value}” + “~”…

If TRUE: Row-update TransView.FilterFlag = true (just a simple made up boolean)

If FALSE: Row-update the same TransView.FilterFlag = false

Now your data rule is simple… if TransView.FilterFlag = true… highlight my textbox.

(I guess you’d have to add an AND condition here to include your PONum condition)

You’ll also want to add a second Data Rule, to turn the highlight OFF if your CustNum value changes and everything is re-evaluated.

3 Likes

You could try updating a row after the form loads to contain your list and then use the ‘Contains’ operator when setting up your rule.

Here I create TransView.CustList to hold my list.

Then you can check if your customer list contains the CustNum in your rule.(I used CustomerCustID instead of CustNum in my case)


CustID is in my list.


CustID isn’t in my list.

2 Likes

Thanks all, will take a look at these excellent suggestions and see how I get on!

My thought was to put all the customer OR queries in one group and the PO num outside of it as an AND, but it just wasn’t having it. Maybe it’s just me learning :joy: