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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Field selection in Script

Hi All,

In a table i have a Value in a field , i want to only get (filter) that field in new field, its throwing error.

in 'Event Type' field i want to only load 'Date Change' values and want it in new field.

i need it in script level.

1 Solution

Accepted Solutions
alexandros17
Partner - Champion III
Partner - Champion III

Load

...

If([Event Type] = 'Date Change', [Event Type], Null()) as SSG_Event_Type

...

Resident

...

let me know

View solution in original post

10 Replies
alexandros17
Partner - Champion III
Partner - Champion III

Load

...

If([Event Type] = 'Date Change', [Event Type], Null()) as SSG_Event_Type

...

Resident

...

let me know

Not applicable
Author

Thankyou Alexandros17

Not applicable
Author

Alessandro i have a similar expression i need to write in script, its showing null

Expression for Event Date.

=if(wildmatch([Event Phase Review Name],'*Phase*'), date([Event Date],'MM/DD/YYYY'))

Thank you in advance.

alexandros17
Partner - Champion III
Partner - Champion III

Try With

if(wildmatch([Event Phase Review Name],'*Phase*') > 0, date([Event Date],'MM/DD/YYYY'), 'NoValue') as myField

Let me know

Not applicable
Author

it is working fine , but not iam expecting  this result.

Calculated Dimension

Eventdate

=if(wildmatch([Event Phase Review Name],'*Phase*'),date([Event Date],'MM/DD/YYYY'))

Its populating 2 records

But After writing in script its showing too many other records even Checked 'Supress Null values'

alexandros17
Partner - Champion III
Partner - Champion III

I do not think that this depends on the new field, it depends on the tables and how they are linked.

But Are you using the =if(wildmatch([Event Phase Review Name],'*Phase*'),date([Event Date],'MM/DD/YYYY'))

as a dimension?

Let me know

Not applicable
Author

ys they are using the same as for Event date

Calculated Dim

=if(wildmatch([Event Phase Review Name],'*Phase*'),date([Event Date],'MM/DD/YYYY'))

used same in Expression for comparison.

=if(wildmatch([Event Phase Review Name],'*Phase*'),Max(date([Event Date],'MM/DD/YYYY')))

first 2 field are calculated Dim, and last 2 are Expression

After the scripting

first 2 fields are Dim, other 2 are expressions.

Thankyou

Not applicable
Author

i scripted the same function to a dimension as you posted before.

if(wildmatch([Event Phase Review Name],'*Phase*') > 0, date([Event Date],'MM/DD/YYYY'), 'NoValue') as myField


But if i use this

if(wildmatch([Event Phase Review Name],'*Phase*'),date([Event Date],'MM/DD/YYYY'))

its showing the same result as above.

alexandros17
Partner - Champion III
Partner - Champion III

The script itself is correct, maybe the field [Event Phase Review Name] is still not available, that is:

If you do

Load
...
if(....) as myField,
If(MyField = ...) as myNewField
...

the script will throw an error because the field myField is not available for another test
(the second if in the example.

In these cases:

Load
...
If(MyField = ...) as myNewField
;
Load
...
if(....) as myField,
...