Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to adapt SQL script in Qlik

I have tried in different ways to adapt my SQL script in Qlik but with no result, maybe you guys can help me with the below.

I need the sql sequence added to my Qliksense script.

SQL:

CASE WHEN (ISNULL(ws.IsCanceled, 0) = 1) THEN 'Anulata'

  WHEN (ws.IsReturned = 0 AND ws.IsClosed = 1) OR (ws.IsReturned = 1 AND ws.IsClosed = 0) THEN 'Inchisa'

  WHEN (ws.IsReturned = 1 AND ws.IsClosed = 1) THEN 'Facturata'

  WHEN (ws.IsReturned = 0 AND ws.IsClosed = 0) THEN 'Deschisa'

  END AS stare_sp,

Qlik:

[WFMWorkStatus]:

LOAD WorkStatusId,

  OrderId AS [WFM2Order.OrderId],

  Number,

  Date,

    Date(Date,'dd/MM/yyyy') AS [DataSP_workstatus],

    Month(Date) AS [lunaDataSP_workstatus],

    Day(Date) AS [ziDataSP_workstatus],

    Year(Date) AS [anDataSP_workstatus],

  IsClosed,

  IsReturned,

  IsCanceled;

  

SELECT WorkStatusId,

  OrderId,

  Number,

  "Date",

  IsClosed,

  IsReturned,

  IsCanceled

FROM "SEA_BO_db".dbo.WFMWorkStatus;

Thanks

1 Reply
sunny_talwar

May be like this:

[WFMWorkStatus]:

LOAD WorkStatusId,

  OrderId AS [WFM2Order.OrderId],

  Number,

  Date,

    Date(Date,'dd/MM/yyyy') AS [DataSP_workstatus],

    Month(Date) AS [lunaDataSP_workstatus],

    Day(Date) AS [ziDataSP_workstatus],

    Year(Date) AS [anDataSP_workstatus],

  IsClosed,

  IsReturned,

  IsCanceled,

  If(Len(Trim(IsCanceled)) = 0, 'Anulata',

       If(IsReturned = 1 and IsClosed = 1, 'Facturata',

            If(IsReturned = 0 and IsClosed = 0, 'Deschisa', 'Inchisa'))) as stare_sp;

 

SELECT WorkStatusId,

  OrderId,

  Number,

  "Date",

  IsClosed,

  IsReturned,

  IsCanceled

FROM "SEA_BO_db".dbo.WFMWorkStatus;