Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Mahamed_Qlik
Specialist
Specialist

Need Help

Hi Guyes,

I have query:

I have two filed in my data mode named as OriginCity and DestinationCity

OriginCity
London
New York
DestinationCity
New York
London

I want to create the new field named as CityPair, If I will create like this:'

OriginCity&'-'&DestinationCity as CityPair then i will get the result like :

CityPair
London-NewYork
New York-London

Instead of this i will need only single row stating London-New York

Regards,

Mahamed

1 Solution

Accepted Solutions
Not applicable

you can simply add one 'if' clause and restrict your data as per your requirement.

For example:

=if(OriginCityName<>DestinationCityName and len(OriginCityName)<>0 and len(DestinationCityName)<>0,RangeMinString(OriginCityName, DestinationCityName) &'-' & RangeMaxString(OriginCityName, DestinationCityName)) 

Hope this helps.

Regards,

Sakir

View solution in original post

10 Replies
Mark_Little
Luminary
Luminary

Hi,

If they are in the same table just

Load

OriginCity&'-'&DestinationCity as CityPair

From Table;


If not you will have to look at join the tables first.


Mark

Mahamed_Qlik
Specialist
Specialist
Author

Hi Mark,

Thank you for your response.

But, if  I will

Load

OriginCity&'-'&DestinationCity as CityPair

From Table;


Then I am getting two records which I had mentioned first.:


London - New York

New York - London


And I need it should show only first record as both falls under same route.

I need London - New York for both of them.


Kindly help.


Regards,

Mahamed

nizamsha
Specialist II
Specialist II

TableA:

Mapping

Load * Inline [

City,Dest

LO-NY,LO-NY

NY-LO,LO-NY

];

Load*,ApplyMap('TableA',NewDes)as NewDes1;

Load *,Origin&'-'&Destination as NewDes;

Load * Inline [

Origin,Destination

LO,NY

NY,LO

];

its one of the way  mark it as correct or helpful if its satisfies you

Mahamed_Qlik
Specialist
Specialist
Author

Hi Nizam,

Can you please help me with the attached .qvw file ?

I do have separate filed for :

Origin city

Destination city

And I do have one filed Routcitypair, but this filed has only citycode and

I want to disply the description in the RoutcitypairName.

For example -

RoutePairCity - ABZ/OSL which mapped with

Aberdeen - oslo

oslo - Aberdeen

I want to create the field RoutcitypairName which should show

Aberdeen - oslo only.

Kindly help.

Regards,

Mahamed

jonathandienst
Partner - Champion III
Partner - Champion III

This will create only one value for each pair regardless of the direction:

RangeMinString(OriginCity, DestinationCity) & '-' & RangeMaxString(OriginCity, DestinationCity) as CityPair

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

Hi Mahamed,

Try:

RangeMinString(OriginCity,DestinationCity) &'-'& RangeMaxString(OriginCity,DestinationCity)as OrderedCityPair

DestinationCity OriginCity CityPair OrderedCityPair
LondonNew YorkNew York-LondonLondon-New York
New YorkLondonLondon-New YorkLondon-New York

Cheers

Andrew

Mahamed_Qlik
Specialist
Specialist
Author

Hi Jonathan,

I have tried and m not able to get the required field.

I have attached the sample copy of qvw.

Can you please check and revert with the applied .qvw

Regards,

Mahamed

Mahamed_Qlik
Specialist
Specialist
Author

Hi Jonathan,

I have tried and m not able to get the required field.

I am getting the records like

London- London

New York - New York too

Which I don't want.

I have attached the sample copy of qvw.

Can you please check and revert with the applied .qvw

Regards,

Mahamed

Not applicable

you can simply add one 'if' clause and restrict your data as per your requirement.

For example:

=if(OriginCityName<>DestinationCityName and len(OriginCityName)<>0 and len(DestinationCityName)<>0,RangeMinString(OriginCityName, DestinationCityName) &'-' & RangeMaxString(OriginCityName, DestinationCityName)) 

Hope this helps.

Regards,

Sakir