Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
dmohanty
Partner - Specialist
Partner - Specialist

Unique Flag?

‌HI all,

This might look simple, but am stuck here. Have a data set like this below -

NameCountry
ChangJapan
AshokUSA
Ashok India
AshokQatar
JohnAustralia
MikeUK
RossUK
GlenGermany
BillUSA
DavidUK
XiomiChina
RaviIndia

Using a load script expression to create an unique flag like this below-

if(match(Country, ‘India’) , ‘Y’ ,

if(match(Country, ‘UK’) , ‘N’

)) as Flag

Need a data set result as below -

NameFlag
ChangN
AshokY
RaviY
JohnN
MikeN
RossN
GlenN
BillN
DavidN
XiomiN

IMPORTANT- I don’t need a flag value as N for Ashok and Ravi. My above script is actually generating N value and I don’t need that.

How can I tweak the script?

4 Replies
chrismarlow
Specialist II
Specialist II

Not sure I follow. I see the following;

313527.png

From script;

data:

Load

if(match(Country, 'India') , 'Y' ,

  if(match(Country, 'UK') , 'N'

  )) as Flag,

*

;

LOAD * INLINE [

    Name, Country

    Chang,Japan

Ashok,USA

...

Regards,

Chris.

nsetty
Partner - Creator II
Partner - Creator II

Try Mapping....

CountryMap:

Mapping Load * Inline [

CC, Flag

India, Y

];

Data:

LOAD

    Name,

    Country

    , ApplyMap('CountryMap', Country, 'N') AS CFlag

FROM [lib://mypath/country.xlsx]

(ooxml, embedded labels, table is Sheet1);

dmohanty
Partner - Specialist
Partner - Specialist
Author

‌Hi  ,chrismarlow

Actually I don’t need NULL values in the result table for Ashok.

CAn we a avoid that in any way?

chrismarlow
Specialist II
Specialist II

Hello,

Is that because Ashok already scores a Y because of India?

Is the rule here you want distinct names with a Y if they have India at all, N if UK & discard the rest?

Cheers,

Chris.