Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

app help - null fields

Hi,

We would like an app to populate an answer in a field if its blank and meets criteria. We have tried adding two expressions to the script but neither works:


"e_mail",if(e_mail = "-", 'No email', 'Has email'),

or

  "tency_end_dt", if(tency_end_dt = null, 'Current Tenancy', 'Previous Tenancy'),

Any suggestions/advice?

Much appreciated.

Chris

1 Solution

Accepted Solutions
marcus_sommer

Now more specific, try:

...

if(len(trim((e_mail))=0, 'No email', 'Has email') as e_mail_CHECK,

if(len(trim(tency_end_dt))=0, 'Current Tenancy', 'Previous Tenancy') as Tenancy_CHECK,

...

- Marcus

View solution in original post

10 Replies
sunny_talwar

If those are null, try this:

If(IsNull(e_mail), 'No email', e_mail) as e_mail or

If(Len(Trim(e_mail)) = 0, 'No email', e_mail) as e_mail

marcus_sommer

Try it with: if(len(trim(YourField))=0, 'empty or null or only spaces', 'values available')

- Marcus

Not applicable
Author

Hi,

I have tried both the above replacing "e_mail" in the script ; however, comes up with error "file not found <null>'

With both 'email' and tenancy end date'  which were trying to add this to there is some values populated (date or an email) but many blanks ("-")

To clarify we are replacing the script below in bold with your suggested expressions?

Load
age,
AgeBand,
Area,
"category_id",
"Client No",
"Contact_method",
DateofBirth,
"Disability_summary",
"e_mail",if(e_mail = "-", 'No email', 'Has email'),
"Economic Status",
Estate,
Ethnicity,
Gender,
"Internet_access",
Latitude,
Longitude,
LongLat,
"Marital Status",
Nationality,
Neighbourhood,
"Preferred Language",
"Primary Client",
"Property_ID",
"PVP_Alert",
Religion,
"Rent Account Name",
"Sexual Orientation",
"Tenancy No",
"Tenant Type",
"tency_end_dt", if(tency_end_dt = null, 'Current Tenancy', 'Previous Tenancy'),
"tency_st_dt",
UPRN,
"Vulnerability level";

Chris

marcus_sommer

Now more specific, try:

...

if(len(trim((e_mail))=0, 'No email', 'Has email') as e_mail_CHECK,

if(len(trim(tency_end_dt))=0, 'Current Tenancy', 'Previous Tenancy') as Tenancy_CHECK,

...

- Marcus

PrashantSangle

Hi,

Try in two statement like

if(e_mail = "-" or len(trim(e_mail))=0, 'No email') as NO_Email,

if(len(trim(e_mail))>0, e_mail) as Has_Email,

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
daveamz
Partner - Creator III
Partner - Creator III

Hi Chris,

For an extra validation for email address field, you can use something like: If(Index(e-mail, '@'), 'Has email', 'No email')

If no '@' is found in the e_mail string, 0 is return, thus FALSE

Regards,

David

Not applicable
Author

Hi all,

Thanks for your input. Tried If(Index(e_mail, '@'), 'Has email', 'No email'), and its worked.

However, with tenancy end date it doesn't work. Can anyone suggest a possible solution? In the date if the tenancy is still live/active then there is '-'. If the tenancy has ended a date exists in the data.

Chris

daveamz
Partner - Creator III
Partner - Creator III

Check Marcus's response. It should work fine.

Not applicable
Author

HI David, Marcus,

Yes the expression works - thank you:

if(len(trim(tency_end_dt))=0, 'Current Tenancy', 'Previous Tenancy') as Tenancy_CHECK,

I will mark as correct but for our understanding could you just explain the logic of how this works....

Chris