If else not working properly for keyword search

Team,

I was doing some keyword search in the excel.

Initially, it is doing the search properly. But my excel output is finally replaced with the Else condition value.

Please find the xaml.keywordIfelse.xaml (23.0 KB)

You are comparing datarow object against a string value so for example when you print that your condition is basically asking:

IF “System.Data.DataRow” = “Crash”

This will always evaluate as False.

This will be the way to evaluate the array against the row item that is passed to the IF statement.

image

keywordIfelse.xaml (6.8 KB)

still its replacing with “else” value only in excel sheet

Please share your updated workflow with the edits suggested

able to fix it

sorry got it. I fixed the issue. Thanks for your support

Its is possible to give sequence if else. Say for example, need to create 5 different arrays. If the array 1 doesnt matches then it should for second like wise.

one more problem iam string. If my string comes in the sentence say for example “crash is the issue” then its not maching the array. my array is {crash,hang,showstopper}

Yes. You can create a two dimensional array and add to that as many sub arrays containing your keywords as you want. You then loop through each array and check each row item in your table against the values.

A counter will help you then see against which array of keywords a match was found.

image

keywordIfelse (3).xaml (11.1 KB)

On this, you need to split the string itself, the sentence being analysed, into an array of words. then you can see if the keywords appear at all in the sentence. that takes a further assign activity to split the row item into separate words, and then another for each to analyse each against each array of keywords.

keywordIfelse (6).xaml (13.5 KB)

Not working as expected. Its replaced with else value. I have attached my xamlinputDT.xlsx (8.0 KB)
keywordIfelse - Copy.xaml (23.0 KB)
and excel.
I

What do you mean? I don’t understand

Finally in excel it’s replaced with my “else” condition

Any hope. IF else condition is not writing properly in the excel as per the keyword search

This just requires some reordering. The original example was cycling through the keyword arrays first then looping by row. You can set it so it cycles through the rows first, then breaks up the sentence into words, finally analysing each. By using the output column as a flag, you can get the loops to be skipped to the next word or row if the keyword has already been found and the output column updated to ‘critical’.

This is a way of controlling such loops within loops. A bit of advice, a pen and some paper will be useful for you to sketch out entry and exit points from the loops as the nested nature of these can grow a little difficult to manage.

However, in this example, as before you can simply add a new array of keywords to the multi-dim array if you need to add more, without needing to alter the rest of the workflow. it is flexible like that.

keywordIfelse_reorder.xaml (29.5 KB)

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.