Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
swiftfahad
Contributor III
Contributor III

making table through if statment

I have a database table like this

DemandNoITNoQuotaionNOTenderNOPoNO
abcxyzs3ss312348910
deferfyuee2313
ghiyuitt4s
jkltre

this is a table of purchasing system: Demand no is assign to demand (requirement) generated by user each demand is then process to different stages. IT, Quotation, Tender, purchase order.

now the value in the field identifies the stage of demand.

e.g

demand abc is complete because it has no null value.

demand def is in tender stage because tender id is assigned to it.

demand ghi is in Quotation stage

demand jkl is in IT stage..

Requirement:

now I want to show the table like

DemandStageDone
abcITy
abcQuotationy
abcTendery
abcPurchase_ordery
defITy
defQuotationy
defTendery
defPurchase_ordern

and so on

any body can help or any body can suggest the better solution to identify the stages of a demand.?

1 Solution

Accepted Solutions
sunny_talwar

Try this:

Table:

CrossTable(Stage, Value)

LOAD DemandNo,

    ITNo,

    QuotaionNO,

    TenderNO,

    PoNO

FROM

[https://community.qlik.com/thread/215233]

(html, codepage is 1252, embedded labels, table is @1);

FinalTable:

LOAD *,

  If(Len(Trim(Value)) = 0, 'n', 'y') as Done

Resident Table;

DROP Table Table;


Capture.PNG

View solution in original post

4 Replies
sunny_talwar

Try this:

Table:

CrossTable(Stage, Value)

LOAD DemandNo,

    ITNo,

    QuotaionNO,

    TenderNO,

    PoNO

FROM

[https://community.qlik.com/thread/215233]

(html, codepage is 1252, embedded labels, table is @1);

FinalTable:

LOAD *,

  If(Len(Trim(Value)) = 0, 'n', 'y') as Done

Resident Table;

DROP Table Table;


Capture.PNG

swiftfahad
Contributor III
Contributor III
Author

thanks bro...

what if i want to add date of each stage in final table..

suppose

DemandNoITNoITdateQuotaionNOQuotationDateTenderNOTenderDatePoNOPoDate
abcxyz04-APr-2016s3ss305-Apr-2016123420-Apr-2016891025-Apr-2016
deferfyuee2313
ghiyuitt4s
sunny_talwar

May be like this?

Capture.PNG

Table:

CrossTable(Stage, Value)

LOAD DemandNo,

    ITNo&'|'&ITdate as ITNo,

    QuotaionNO&'|'&QuotationDate as QuotaionNO,

    TenderNO&'|'&TenderDate as TenderNO,

    PoNO&'|'&PoDate as PoNO

FROM

[https://community.qlik.com/thread/215233]

(html, codepage is 1252, embedded labels, table is @3);

FinalTable:

LOAD DemandNo,

  Stage,

  SubField(Value, '|', 1) as Value,

  SubField(Value, '|', 2) as Date,

  If(Len(Trim(SubField(Value, '|', 1))) = 0, 'n', 'y') as Done

Resident Table;

DROP Table Table;

swiftfahad
Contributor III
Contributor III
Author

thanks alot