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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
darren_dixon
Contributor III
Contributor III

Use created field in script

Hi,

I've used an IF statement to collate the variations of Emergency into one.

I'd then like to use the newly created [Emergency Field] later in my code.


How would I do this?

if(Priority='Emergency (24h)', 'Emergency (24h)',

    if(Priority='Emergency (24hr)', 'Emergency (24h)',

    if(Priority='emergency 24', 'Emergency (24h)',

    if(Priority='Emergency 24h', 'Emergency (24h)', 'Non-Emergency')))) AS [Emergency Status]

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

You can do that with a preceding load.

Load

If([Emergency Status]= ''..xxx...', 1, 0) as NewEmergency

...some other fields...;

Load

if(Priority='Emergency (24h)', 'Emergency (24h)',

    if(Priority='Emergency (24hr)', 'Emergency (24h)',

    if(Priority='emergency 24', 'Emergency (24h)',

    if(Priority='Emergency 24h', 'Emergency (24h)', 'Non-Emergency')))) AS [Emergency Status]

...some other fields...

from ...somewhere...;

The second load pipes the data into the preceding load so the new field Emergency Status is available for use in the preceding load. See this blog post for more information.


talk is cheap, supply exceeds demand

View solution in original post

1 Reply
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

You can do that with a preceding load.

Load

If([Emergency Status]= ''..xxx...', 1, 0) as NewEmergency

...some other fields...;

Load

if(Priority='Emergency (24h)', 'Emergency (24h)',

    if(Priority='Emergency (24hr)', 'Emergency (24h)',

    if(Priority='emergency 24', 'Emergency (24h)',

    if(Priority='Emergency 24h', 'Emergency (24h)', 'Non-Emergency')))) AS [Emergency Status]

...some other fields...

from ...somewhere...;

The second load pipes the data into the preceding load so the new field Emergency Status is available for use in the preceding load. See this blog post for more information.


talk is cheap, supply exceeds demand