Filter Example with upper and lower case

Prentice
Prentice New Altair Community Member
edited November 2024 in Community Q&A
Hi again,

After just asked this question and accepted it, but I've ran into yet another problem. Yes, the solution works, but when I try to apply it to my real data it fails and I can't seem to figure out why. So this is what I exactly have:

Read Excel -> Extract Macro.
This reads an Excel file where I then have a macro (CustomerName) that stores the customer name from the excel file which will be used in the filter. 

I have another path that goes like this:
Read Excel -> Filter Examples -> Res
I have it read a different sheet in the Excel file and then a filter for the customer name applied for the customer attribute. This filter reads as follows:  "matches(Customer,".+"+%{CustomerName}+".+") and this filters it correctly, except the few cases where the customer is capitalised. 
I've tried the following which I saw in another thread:  "matches(lower(Customer),".+"+%{CustomerName}+".+") this filters everything out and leaves only the attributes. 

So the answer that @mschmitz gave me in my previous question does work, however it leaves out the few cases where the customer is capitalised

Thanks again!
I'm sorry for the amount of (simple) questions I ask, but I'm just not fully familiarised with the software

-Prentice

Best Answer

  • kayman
    kayman New Altair Community Member
    Answer ✓
    Not sure if I fully get it but in order to completely ignore cases also your macro should become lowercase, so I would try to generate a new macro (using the same name) where you create CustomerName = lower(%{CustomerName}) so that you compare your lower cased customer with your lower cased Customername

Answers

  • kayman
    kayman New Altair Community Member
    Answer ✓
    Not sure if I fully get it but in order to completely ignore cases also your macro should become lowercase, so I would try to generate a new macro (using the same name) where you create CustomerName = lower(%{CustomerName}) so that you compare your lower cased customer with your lower cased Customername

  • Prentice
    Prentice New Altair Community Member
    This actually worked, you're right. The macro needed to be lower case. Thanks!