# QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join us for a live Q&A! September 21, 10 AM ET - Onboarding Fast in Qlik Sense SaaS! REGISTER
cancel
Showing results for
Did you mean:
Contributor

## Comparing String

Hi All,

I have 2 columns namely CityA and CityZ in the qvd.

They have values like AHMD, MUMB, CHNI, BNGR etc.

But I need to compare the cities, if CityA is numerically higher than the CityZ, the swap the values.

For example,

CityA                    CityZ

--------------------------------

AHMD                    MUMB

CHNI                     BNGR

I need to check if CHNI is numerically higher than BNGR, then CityA will be BNGR and CityZ will be CHNI.

Also there is one more column called Area for each City column.

Example,

CityA                   AreaA                          CityZ                         AreaZ

-----------------------------------------------------------------------------------

AHMD                   S V Road                   MUMB                     Marg

So if we swap the citynames, that particular area name should also get swapped.

1 Solution

Accepted Solutions

What do you mean 'numerically higher'? Text values are not numbers so the cannot be numerically anything. If you simply want to compare the alphabetic rankings then try: if( CityA > CityZ, CityA, CityZ).

talk is cheap, supply exceeds demand
4 Replies

What do you mean 'numerically higher'? Text values are not numbers so the cannot be numerically anything. If you simply want to compare the alphabetic rankings then try: if( CityA > CityZ, CityA, CityZ).

talk is cheap, supply exceeds demand
Partner

You have something like :

Load CityA, AreaA,  CityZ, AreaZ from xxx.qvd

transform it in:

If(CityA > CityZ, CityZ, CityA) as CityA,

If(CityA > CityZ, AreaZ, AreaA) as AreaA

If(CityA > CityZ, CityA, CityZ) as CityZ,

If(CityA > CityZ, AreaA, AreaZ) as AreaZ

.....

from xxx.qvd

Let me know

Contributor
Author

Thanks Gysbert. But what about the swapping of the related column?

if( CityA > CityZ, RegionA, RegionZ).

talk is cheap, supply exceeds demand
Community Browser