Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Customer & Partners, DEC. 9, 11 AM ET: Qlik Product & Strategy Roadmap Session: Data Analytics REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
rpayn01215
Creator
Creator

Fiscal Master Calendar Script Error ')' Expected

Hi All,

I'm attempting to write a fiscal calendar and need a flag for previous and current year and month, but got stuck. I'm getting errors as commented in the below script. Does anybody have any suggestions or syntax changes to make this logic work?

NoConcatenate

tempFisc2:   //one row table to feed variable values

LOAD

FiscalYear,

FiscalQuarter,

FiscalMonth

Resident tempFiscCal

Where CalendarDate = Date(Now())    //Today's Date >>> should it be Date(Today())?

;

LET v_RP_CFyr = peek('FiscalYear', 0, 'tempFisc2');      //should have a value of '2016', 1st (only) row of above

LET v_RP_CFQ = peek('FiscalQuarter', 0, 'tempFisc2');

LET v_RP_CFMo = peek('FiscalMonth', 0, 'tempFisc2');

NoConcatenate

FiscCal:

LOAD *,

FiscalMonth & '-' & FiscalYear as FiscalMonthYear,

if($(v_RP_CFyr) = FiscalYear, 1,0) as cFYr_Flag,      //says ')' expected

if(peek('FiscalYear', 0, 'tempFisc2') = FiscalYear, 1, 0) as cFYr_Flag2     //tried this, returns 0 only

if(v_RP_CFyr = FiscalYear, 1,0) as cFYr_Flag3,      //field not found (due to resident load)

Resident tempFiscCal;

DROP Table tempFiscCal, tempFisc2;

1 Solution

Accepted Solutions
marcus_sommer
MVP & Luminary
MVP & Luminary

I think the reason is how you used the variables - if a variable contained a numeric value you could access them with $(var) and if they contained a string you need single-quotes around the variable like: '$(var)'

Here you find many useful links to fiscal calendar and flagging from periods and some more topics: How to use - Master-Calendar and Date-Values.

- Marcus

View solution in original post

3 Replies
israelcsouza
Contributor III
Contributor III

Hi Ron Payne,

Upload the QVW exemple.

marcus_sommer
MVP & Luminary
MVP & Luminary

I think the reason is how you used the variables - if a variable contained a numeric value you could access them with $(var) and if they contained a string you need single-quotes around the variable like: '$(var)'

Here you find many useful links to fiscal calendar and flagging from periods and some more topics: How to use - Master-Calendar and Date-Values.

- Marcus

View solution in original post

rpayn01215
Creator
Creator
Author

Thanks, Marc. This was a good suggestion. I have forced my variable to num and changed WHERE... date(now()) to date(today()). I'm uploading the same qvw to show you how it works using the variables before the final load.