Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
nevilledhamsiri
Specialist
Specialist

Assigning 'Y' for blank & '- ' spaces in a field

Hi Members,

The field which carries 'Y' & 'N' to be left as they are while assigning 'y' for all blanks & '-' places.Also I have applied the where clause for records with 'y'. Once this is done, I need all the records which are not duplicated & with 'y' assigned to settled field to be loaded. Also see the error in the if formula written to achieve this which seems to be not working.

 

Thanks

 

Neville

2 Solutions

Accepted Solutions
sunny_talwar

This should work

DATA:
LOAD [POLICY_ NUMBER],
	 AGENT, SCORE,
	 SETTLED,
	 IF(Len(Trim(SETTLED)) = 0 or SETTLED = '-', 'Y', SETTLED) AS NEW_SETTLED
FROM [DISTINCT LOAD.xlsx]
(ooxml, embedded labels, table is Sheet1);

View solution in original post

edwin
Master II
Master II

the first problem is your where statement.  with the SETTLED='Y' criteria, everything that does not have a Y is immediately excluded.  what i think you really wanted was to exclude 'N' - this way the spaces and dashes are pulled in and can be transformed properly.  try this:

...  WHERE NOT EXISTS([POLICY_ NUMBER])AND SETTLED<>'N';

edwin_0-1599156789987.png

 

View solution in original post

6 Replies
sunny_talwar

This should work

DATA:
LOAD [POLICY_ NUMBER],
	 AGENT, SCORE,
	 SETTLED,
	 IF(Len(Trim(SETTLED)) = 0 or SETTLED = '-', 'Y', SETTLED) AS NEW_SETTLED
FROM [DISTINCT LOAD.xlsx]
(ooxml, embedded labels, table is Sheet1);
nevilledhamsiri
Specialist
Specialist
Author

Hi Sunny, Your solution is ok  as long as the restrictions that I have done through where clause is no longer there. But once it is applied, expected results wont come. I need the records which are assigned with 'Y' and not duplicated to be loaded. See the where clause used for achieve this.

LOAD [POLICY_ NUMBER], AGENT, SCORE, SETTLED,IF(LEN(TRIM(SETTLED))=0 OR SETTLED='-','Y',SETTLED)AS NEW_SETTLED
FROM [D:\DISTINCT LOAD.xlsx] (ooxml, embedded labels, table is Sheet1)WHERE NOT EXISTS([POLICY_ NUMBER])AND SETTLED='Y';

 

 

nevilledhamsiri_0-1597945896409.png

Any advice to achieve this.

Thanks

nevilledhamsiri
Specialist
Specialist
Author

Once everything is done only following records to be the results.

RA001C125P200Y
RA001C132P12Y
RA001C133L12 
RA001C134P12 
RA001C135O12 
RA001C136P12 
RA001C137L12-
RA001C138K12-
RA001C139L12-
Brett_Bleess
Former Employee
Former Employee

@sunny_talwar  Hey sir, this dang notification issue is killing me, just flagging things for you, sorry for the trouble on the notifications, hopefully the platform team can get that handled shortly for us.

Cheers,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.
edwin
Master II
Master II

the first problem is your where statement.  with the SETTLED='Y' criteria, everything that does not have a Y is immediately excluded.  what i think you really wanted was to exclude 'N' - this way the spaces and dashes are pulled in and can be transformed properly.  try this:

...  WHERE NOT EXISTS([POLICY_ NUMBER])AND SETTLED<>'N';

edwin_0-1599156789987.png

 

nevilledhamsiri
Specialist
Specialist
Author

Thanks Edvin

This is a solution  what I looked forward to

 

Neville