Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
ant2
Contributor
Contributor

Can't create a flag to identify a field containing a dash

Hello

I have a table like this:

ant2_0-1700218109056.png

I have created the field EmptyFlag to identify any row that has a null/ empty/ blank in the Name column.

In my data load script I've used the following to try and achieve this:

if(Len(Trim(Name)) = 0, 0, 1) as EmptyFlag
If(Len(Trim(Name)) > 0, 1, 0) as EmptyFlag
if(IsNull(Name), 0, 1) as EmptyFlag
if(Name = '' or Name = '-', 0, 1) as EmptyFlag

 

However, as per above, if the Name field contains a dash (-), then the EmptyFlag also contains a dash(-) and not a zero (0).

 

Can anyone advise how I can go about selecting the rows in my table where the Name column contains a dash.

Thanks,

Tony.

 

Labels (1)
2 Replies
whiteymcaces
Partner - Creator
Partner - Creator

If(Len(Name) > 0, 1, 0) as EmptyFlag should work. If it doesn't work it means that the length of the Field [Name] is not zero.

Does the data actually contain a dash "-" OR is the dash representing Null? If there is an actual dash, then the length will obviously not be zero, and you will need to handle this another way.

Another question to ask yourself is Why do you want to keep row with no name, and is there a better way to identify rows with no name. Without seeing the actual data and without knowing exactly what you are trying to achieve, it is difficult to provide any specific answers.

marcus_sommer

Are you really looking on the data of this table? I assume rather not. A check would be quite simple - just add recno() and rowno() to this load and then pull these record-id's + Name + EmptyFlag in a table-box (means no other fields and no expressions). I think there would be no dashes but continuous record-id's. In this case the dashes (displayed as replace for NULL) are caused from an association between this tables and your other tables.