Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Highlighted
dunnalahk123
Contributor II

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
New Contributor III

Re: Scenario for Expression in Script

Hi,

Sorry try below one.

A:

Load ProjectID

from table where Flag=1;

B:

Load *

from table where not exists(ProjectID);

Drop table A;

7 Replies
daanciorea
New Contributor III

Re: Scenario for Expression in Script

Hi,

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

Dan.

anushree1
Valued Contributor

Re: Scenario for Expression in Script

Pleas try the below snippet:

Load * from tablename

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

 

dunnalahk123
Contributor II

Re: Scenario for Expression in Script

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
Valued Contributor

Re: Scenario for Expression in Script

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
New Contributor III

Re: Scenario for Expression in Script

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
New Contributor III

Re: Scenario for Expression in Script

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
New Contributor III

Re: Scenario for Expression in Script

Hi,

Sorry try below one.

A:

Load ProjectID

from table where Flag=1;

B:

Load *

from table where not exists(ProjectID);

Drop table A;