Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
katetsan
Creator
Creator

Compare String Fields

Hi Communities,

Is there anyway to compare two string fields?

Here is the if statement I have wrote in scripts. I'm going to create a new field which compare two string fields, but the outcome isn't correct. Is there anyone could help it up?

if(Trim([Company Country])=Trim([Deliver-To Party Country]),'TRUE','FALSE') as [Country Check],

7 Replies
YoussefBelloum
Champion
Champion

Hi,

can you attach some data ?

sasiparupudi1
Master III
Master III

Try wildmatch

if(Wildmatch(Trim([Company Country]),Trim([Deliver-To Party Country])),'TRUE','FALSE') as [Country Check]

jonathandienst
Partner - Champion III
Partner - Champion III

Your syntax is correct, so you will need to be more specific about why this does not work and what you require. Are you looking for a case sensitive, case insensitive or fuzzy comparison?

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
shiveshsingh
Master
Master

Syntax is correct, can you share sample data?

katetsan
Creator
Creator
Author

Experts,

I found that I might made a logical mistake in the script.

Originally I would like to create a new field which will compare two fields from different two tables.

Therefore, I create a temporary link table for inner joining the two tables.

That would be grateful to receive your suggestions of comparing two fields from two different two tables.

sasiparupudi1
Master III
Master III

Please close this thread

PrashantSangle

If you want to create flag field before joining them. or there is no common key between them then try with lookup()

like.

Id:

LOAD * INLINE [

    ID1

    1

    2

    3

    4

    5

];

data:

LOAD ID2,Name,If(Lookup('ID1','ID1',ID2,'Id')>0,'True','False') as flag INLINE [

    ID2, Name

    1, a

    2, b

    3, c

    4, d

    6, e

    7, f

];

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂