Change variable to uppercase

Hi All,

i am stuck in small logic, kindly help me to resolve my issue.

there is one CRM search option, in which if i search for some initial, let say ABC, it provide the details of ABC as a table.

so in some initials what happening is ABC is a scrapped variable which is passing everytime to the CRM search option, and it match with CRM data, but in CRM , column “initials” can be in upper case or can be in lower case as well like Abc or abC.

because of this for some of the data doesn’t match.

what i have done is

i scraped the data,
then put filter wizard, so that it should match the initials first and then look for other condition.
image
image

“Initials” is the column of CRM.
sNNinitials is scrapped variable.

so i want to convert the column value to be in uppercase always, so that it should match.

Have you tested to turn off the CaseSensitive option before the filter activity?

dtNN.CaseSensitive = False

no, where i will find this in property panel?

Just use an Assign activity:

image

aah, ok. let me run now

Just tested on my computer. The Filter Data Table activity doesn’t seem to care about the CaseSensitive option. So you will have to use DataTable.Select() to filter instead.

outdtNN = dtNN.Select(String.Format("Initials = '{0}'", sNNinitials)).CopyToDataTable

image

yes, it passed that condition,

let me try with this condition.

not working that condition.

image

What is not working? I have tested on my computer and it’s working fine.

Hi @Rakesh_Tiwari,

Adding to the cool answers from @ptrobot!

You can do it in an alternative way:

In the For Each Row you can use a for loop and reset values to item.Item("Initials") = item("Initials").ToString.ToUpper

ColumnUpperCase.xaml (10.2 KB)

1 Like

yes, that’s working fine

Thank you so much.

Hi @ptrobot ,

i have one more issue.

the situation is like i have some condition, which i have mentioned in filterDT, but the problem is, it is matching for some initials and for some it is not matching even the data is correct in Data table.

this sequence has written right after that solution provided by you.

let me know if you required more information.

There might be spaces around the string. Have you tested with Trim()?

item.Item("Initials") = item("Initials").ToString.ToUpper.Trim

no, let me check

Hi,

the yesterday’s post is closed, and i asked i think different query.

please refer my today’s post.

In today’s post you referred to “initials” but in the screenshot provided there’s nothing about “initials”. I can see that you are referring to “Dept. No.” and “Manager”. Can’t you apply the same logic as you did yesterday with @jeevith’s solution, but add Trim? E.g.

item.Item("Manager") = item("Manager").ToString.ToUpper.Trim

Hi,

tried, but not working for some of the user even if the deptno and manager is same.

below is the code, let me know if the done something wrong.

image

Hi! Move out the Filter Data Table activity and the Output Data Table activity outside the For Each Row loop. And also you need three assign in the the for loop:

item.Item("Initials") = item("Initials").ToString.ToUpper.Trim
item.Item("Manager") = item("Manager").ToString.ToUpper.Trim
item.Item("Dept. No.") = item("Dept. No.").ToString.ToUpper.Trim

Add more assign if you need to compare other columns also.

ok, i will try with this code.

but my question is why it is matching for most of the user and not matching with few user?

Because you have the Filter activity in the For Each Row loop. You need to convert all the column values to upper case and trim first before the Filter activity. If you do the filter in the loop, some of the values might not have been converted yet and thus doesn’t match.