Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
dunnalahk123
Creator III
Creator III

Scenario for Expression in Script

Hi,

 

Can some one help me here how can we write in script  for below scenario

 

I have one Project ID for that we will have multiple Subtasks , out of that if one subtask is bad i want to exclude complete Project. how can i do it.

in below example one project has multiple Subtasks out of that if i have one Bad subtask at least  (ExclusionProjectFinalFlag='1') then i want to exclude that Project completely from my report .

 

how ca i write in script, can some one help me here.

1.PNG

Best Regards,

HK

Labels (2)
1 Solution

Accepted Solutions
sultanam
Contributor III
Contributor III

Hi,

Sorry try below one.

A:

Load ProjectID

from table where Flag=1;

B:

Load *

from table where not exists(ProjectID);

Drop table A;

View solution in original post

7 Replies
daanciorea
Partner - Contributor III
Partner - Contributor III

Hi,

Try load again your data with Resident statment and where ExclusionProjectFinalFlag = 1. Don't forget to drop your initial data.

Dan.

anushree1
Specialist II
Specialist II

Pleas try the below snippet:

Load * from tablename

where ExclusionProjectFinalFlag<>1;(use '1' if the flag is a character if numeric no quotes)

 

dunnalahk123
Creator III
Creator III
Author

Hi,

 

Same i wrote , but it is not working.

 

why because

1 project has multiple subtask so if i write like above  its just excludes only that subtasks which is ExclusionProjectFinalFlag='1' still that Project appears in the report.

 

my point is for project if one subtask has ExclusionProjectFinalFlag='1' that project itself should be excluded from the report.

anushree1
Specialist II
Specialist II

Ok Please try this:

Temp:

LOad Proj_id

from<Table Name > where ExclusionProjectFinalFlag='1'(quotes only if character);

Final:

Load Proj_id as ProjectID,

Other Col Names,,,,,

From <Table Name >

where not exists(Proj_id,ProjectID);

daanciorea
Partner - Contributor III
Partner - Contributor III

Hi,

Then try ssomethinnk lile this:

A:
Load
ID_Proyect,
Max(ExclusionProjectFinalFlag) as ExclusionProjectFinalFlag
Redident YourTable Group By ID_Proyect;

B:
Load
ID_Proyect,
...
Resident YourTable;
Right Join(B)
Load
ID_Proyect
Resident A Where ExclusionProjectFinalFlag = 1;

Drop Tables YourTable, A;

Table B must contains only the proyects that there aren's bad subproyects.

Dan.
sultanam
Contributor III
Contributor III

Hi,

You can try below.

A:

Load ProjectID

from your table;

B:

Load 
*

from your table
where not exists(ProjectID) ;

Drop Table A;

Note : Please use the correct fields name.

sultanam
Contributor III
Contributor III

Hi,

Sorry try below one.

A:

Load ProjectID

from table where Flag=1;

B:

Load *

from table where not exists(ProjectID);

Drop table A;