Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Become an analytics expert with Qlik's new 15 week course: Applied Data Analytics using Qlik Sense. READ MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

script issue

hello,

I am facing some issue in scripting can any one correct me.

Syntax error, missing/misplaced FROM:

     If(SNO_WEEK=1,'FW' & Right(FISCAL_YEAR_WEEK_NUM,2)),

       If(SNO_WEEK >= 1 and SNO_WEEK <= 4,'FW' & Right(Max(FISCAL_YEAR_WEEK_NUM),2) &'-' &'FW' & Right(Min(FISCAL_YEAR_WEEK_NUM),2),

       If(SNO_WEEK >= 1 and SNO_WEEK <= 13,'FW' & Right(Max(FISCAL_YEAR_WEEK_NUM),2) &'-' &'FW' & Right(Min(FISCAL_YEAR_WEEK_NUM),2),

       If(SNO_WEEK >= 1 and SNO_WEEK <= 52,'FW' & Right(Max(FISCAL_YEAR_WEEK_NUM),2) &'-' &'FW' & Right(Min(FISCAL_YEAR_WEEK_NUM),2),

       ))))

       AS TIMELINE,

 

Thanks

14 Replies
Not applicable
Author

I Want output like below based on above script.

TIMELINE

--------------

FW30

FW26-FW30

FW18-FW30

Thanks

bill_markham

Just  looking at the first line :

    If ( SNO_WEEK=1,'FW' & Right FISCAL_YEAR_WEEK_NUM,2 ) ) ,

You have have two pair of brackets so that has ended the if statement.  Try removing the final bracket.  This may well introduce another error and you'll need to sort any subsequent errors one at time.

aveeeeeee7en
Specialist III
Specialist III

Try this:

     If(SNO_WEEK=1,'FW' & Right(FISCAL_YEAR_WEEK_NUM,2),

       If(SNO_WEEK >= 1 and SNO_WEEK <= 4,'FW' & Right(Max(FISCAL_YEAR_WEEK_NUM),2) &'-' &'FW' & Right(Min(FISCAL_YEAR_WEEK_NUM),2),

       If(SNO_WEEK >= 1 and SNO_WEEK <= 13,'FW' & Right(Max(FISCAL_YEAR_WEEK_NUM),2) &'-' &'FW' & Right(Min(FISCAL_YEAR_WEEK_NUM),2),

       If(SNO_WEEK >= 1 and SNO_WEEK <= 52,'FW' & Right(Max(FISCAL_YEAR_WEEK_NUM),2) &'-' &'FW' & Right(Min(FISCAL_YEAR_WEEK_NUM),2),

       ))))

       AS TIMELINE,

Regards

Aviral Nag

Not applicable
Author

Yes already I have tried that....but this time getting error as Invalid expression.

Thanks

bill_markham

That error is probably coming from somewhere else in your LOAD statement.

Try commenting out lines from it until it runs without failing and you should be able to find out which is the dodgy line.

Maybe you could post the whole load statement.

Not applicable
Author

CALENDAR:

LOAD SNO_WEEK,

     FISCAL_YEAR_WEEK_NUM,

     Right(FISCAL_YEAR_WEEK_NUM,2) as WEEK,

     If(SNO_WEEK=1,'FW' & Right(FISCAL_YEAR_WEEK_NUM,2),

       If(SNO_WEEK >= 1 and SNO_WEEK <= 4,'FW' & Right(Max(FISCAL_YEAR_WEEK_NUM),2) &'-' &'FW' & Right(Min(FISCAL_YEAR_WEEK_NUM),2),

       If(SNO_WEEK >= 1 and SNO_WEEK <= 13,'FW' & Right(Max(FISCAL_YEAR_WEEK_NUM),2) &'-' &'FW' & Right(Min(FISCAL_YEAR_WEEK_NUM),2),

       If(SNO_WEEK >= 1 and SNO_WEEK <= 52,'FW' & Right(Max(FISCAL_YEAR_WEEK_NUM),2) &'-' &'FW' & Right(Min(FISCAL_YEAR_WEEK_NUM),2),

       ))))

       AS TIMELINE,

     SNO_MONTH,

     FISCAL_YEAR_MONTH_NUM

    // CREATE_DT,

   //  CREATE_USER_ID,

   //  LAST_UPDTD_DT,

   //  F8

FROM

I have checked it line by line....first if statement is fine....after that I was facing issue

veidlburkhard
Creator III
Creator III

Hi SwathiRaj,

I tried to analyse your if structure and found that when SNO_Week = 1 is true, also SNO_Week >=1 and SNO_Week <= 4 and...and SNO_Week >=1 and SNO_Week <= 52 are true. So there is no real alternative.

Seems you should write:

SNO_Week > 1 and SNO_Week <=4,

SNO_Week >4 and SNO_Week <= 13 etc.


Hope this helps


Burkhard

Not applicable
Author

Thax for your reply but it wont work here getting same invalid expression

maxgro
MVP
MVP

remove min and max