Hy Guys,
I saw the file with the expressions that you will use and can say something about it to improve the validation.
1- Make the trasnformation / create new columns with the final values to be compare. It will make easier to split logical from data informaiton.
2- you can use a column expression legacy to create at once all condicional for each case, sort the size about your programming code and avoid problems with variabes and conditionals.
3- for eache validation (new coluns with return), you can create a rule engine validation to see each result and assign a value for erros that will be null or ‘0’ as empty problems or you can contact or just set a value that show that you have some problems (like a count).
It will help you for debug part of the validation and at the end, you can sum or concatenate string about erros returns.
Some “IF questions” can use regular expressions to validate with to sort data. Example:
(
contains(lowerCase(column(“Descripción”)), “oxxo”) ||
contains(lowerCase(column(“Descripción”)), “fruna”) ||
contains(lowerCase(column(“Descripción”)), “mayorista 10”) ||
contains(lowerCase(column(“Descripción”)), “acuenta”) ||
contains(lowerCase(column(“Descripción”)), “jumbo”) ||
contains(lowerCase(column(“Descripción”)), “tottus”) ||
contains(lowerCase(column(“Descripción”)), “unimarc”) ||
contains(lowerCase(column(“Descripción”)), “líder”) ||
contains(lowerCase(column(“Descripción”)), “lider”) ||
contains(lowerCase(column(“Descripción”)), “santa isabel”) ||
contains(lowerCase(column(“Descripción”)), “local savory”) ||
contains(lowerCase(column(“Descripción”)), “punto copec”) ||
contains(lowerCase(column(“Descripción”)), “alvi”) ||
contains(lowerCase(column(“Descripción”)), “ganga”)
)
will be:
regexMatcher(contains(lowerCase(column(“Descripción”))),“(oxxo|fruna|mayorista 10|acuenta|jumbo|tottus|unimarc|líder|lider|santa isabel|local savory|punto copec|alvi|ganga)”)
So you can short the lines to just words.
The result will be a false or true and you can set it into a new column output or replace a one.
Here you can create more expressions for each needs, just click at the plus sign (+) above expression column.
After that node, you can creat another to sum all columns values for the final answer.
Another tip about conditionals is use a single question to validade a conditional and the anser will be write into 2 parts. Example:
column(“Descripción”)
// Establecimiento: Si es Punto de compra indefinido, Descripción no debe mencionar tiendas conocidas
result = errores == “” ? join(“ERROR”, " - ", “V”, " - ", “Establecimiento”, " - ", “Punto de compra mencionado en Descripción”) : join(errores, " || ", join(“ERROR”, " - ", “V”, " - ", “Establecimiento”, " - ", “Punto de compra mencionado en Descripción”));
result => will return the answer
errores == “” ? => the question for the if situation
: => 2 answers, before the “:” the first for true, and the second part for false
I try to give you some tips to short the code and a information to make transformation before the validation to not need to do it inside the code
If I can help more, just call me here again ok?
If you can upload a sample about your data (fiction ones)
Thanks,
Denis