Is there a way to make a restriction on a lis...

expressions
(Alfredo Pou) #1

Is there a way to make a restriction on a list that instead of looking for an exact match, restricts by any of the criteria words?

For example: I need to find a spare for a repair of a spare parts list in stock, but only show spare parts for that brand and model. The list may not be loaded exactly as in the repair.

If the repair was a Motorola G5 + XT1680 cell phone, the list might contain brand: Motorola, model: G5 +, or model: XT1680.

If restrictions could be made for all the words in the text, a list could be obtained with all the G5 +, plus all the XT1680.

Is it possible to make a restriction like this?

Reading about the SELECT expression, it does not seem possible to use several restriction criteria.

Thank you for your contribution

(Aleksi Alkio) #2

You can do that for example like… SELECT(TableName[ColumnName],OR(CONTAINS([Column],[_THISROW].[Model]),CONTAINS([Column]=[_THISROW].[Brand]))

(Alfredo Pou) #3

@Aleksi_Alkio Yes, that’s the way I used it several times. What I am looking for in this case is to select one or more values from a list created with the SPLIT expression, with which I can not use OR.

SELECT (Spare Parts List [Spare Id], Contains ([Model], OR ([SearchModel])))

Where [SearchModel] is a virtual column with this formula app:

Split ([Rep Id]. [Commercial Model] & “” & [Rep Id]. [Internal model number], “”)

This expression does not work, but it represents what I want to obtain.

In the example I put, the commercial model would be Moto G5 and the internal model would be XT1625. By concatenating the 2 and applying SPLIT I get a list of words: moto, G5, XT1625.

In the list of spare parts in stock it could appear as: brand = Motorola and model = G5 as well as model = XT1625 or model = moto G5.

The idea is that you can find any of the occurrences and show all the spare parts options for that model. Even the idea later, would be to add an IF for the case that the list is empty, filter only by brand and show all the spare parts of that brand. Is it possible to do this?