8 Replies Latest reply: Oct 2, 2018 9:28 AM by Beck Bakytbek

autocalender: problem with expressions

Hi Folks,

i have the following Situation, i created the master calender with the help of functions: declare field Definition, see below:

[autoCalendar]:
DECLARE FIELD DEFINITION Tagged ('\$date')
FIELDS
Dual(Year(\$1), YearStart(\$1)) AS [Year] Tagged ('\$axis', '\$year'),
Dual('Q'&Num(Ceil(Num(Month(\$1))/3)),Num(Ceil(NUM(Month(\$1))/3),00)) AS [Quarter] Tagged

('\$quarter'),
Dual(Year(\$1)&'-Q'&Num(Ceil(Num(Month(\$1))/3)),QuarterStart(\$1)) AS [YearQuarter] Tagged

('\$axis', '\$yearquarter'),
Month(\$1) AS [Month] Tagged ('\$month'),
Dual(Year(\$1)&'-'&Month(\$1), monthstart(\$1)) AS [YearMonth] Tagged ('\$axis', '\$yearmonth'),
Dual('W'&Num(Week(\$1),00), Num(Week(\$1),00)) AS [Week] Tagged ('\$weeknumber'),
Date(Floor(\$1)) AS [Date] Tagged ('\$date');

DERIVE FIELDS FROM FIELDS [datum] USING [autoCalendar]

my Problem is:

if i try to build the Expression: sum({\$<[datum.autoCalendar.Year] = {\$(=max([datum.autoCalendar.Year]))}>}budget) but it does not work,

but if i transform the field:datum in year(datum) as test_year and then create the Expression:

sum({\$<test_year = {\$(=max(test_year)-1)}>}budget) then it does work.

Can anybody explain me these differences?

or if i create the datafields with the helps of function: declare fields i can not use that in set expressions.

Thanks a lot

Beck

• Re: autocalender: problem with expressions

I think this seems to be a formatting problem... because derived calendar is a dual field, it needs to use additional formatting... try this

Sum({\$<[datum.autoCalendar.Year] = {"\$(=YearStart(Max([datum.autoCalendar.Year])))"}>} budget)

• Re: autocalender: problem with expressions

Hi Sunny,

thanks a lot for your Feedback, i tried but it does not work

• Re: autocalender: problem with expressions

Alright, can you try to change the script for derived calendar.... PLEASE NOTE that I have never done this, so make sure to backup your app before you try this....

[autoCalendar]:
DECLARE FIELD DEFINITION Tagged ('\$date')
FIELDS
Year(\$1) AS [Year] Tagged ('\$axis', '\$year'),
Dual('Q'&Num(Ceil(Num(Month(\$1))/3)),Num(Ceil(NUM(Month(\$1))/3),00)) AS [Quarter] Tagged

('\$quarter'),
Dual(Year(\$1)&'-Q'&Num(Ceil(Num(Month(\$1))/3)),QuarterStart(\$1)) AS [YearQuarter] Tagged

('\$axis', '\$yearquarter'),
Month(\$1) AS [Month] Tagged ('\$month'),
Dual(Year(\$1)&'-'&Month(\$1), monthstart(\$1)) AS [YearMonth] Tagged ('\$axis', '\$yearmonth'),
Dual('W'&Num(Week(\$1),00), Num(Week(\$1),00)) AS [Week] Tagged ('\$weeknumber'),
Date(Floor(\$1)) AS [Date] Tagged ('\$date');

DERIVE FIELDS FROM FIELDS [datum] USING [autoCalendar]

• Re: autocalender: problem with expressions

And then try your original expression

sum({\$<[datum.autoCalendar.Year] = {\$(=max([datum.autoCalendar.Year]))}>}budget)

• Re: autocalender: problem with expressions

Sunny,

first of all, thanks a lot for your help and Feedback, i tried, but it does not work, i think, it is possible to use this technique as filter, but in the case of Expression it does not match

Thanks a lot

• Re: autocalender: problem with expressions

I hoped that it would work... but in any case... this should work

Sum({\$<[datum.autoCalendar.Year] = {"=Only({1} [datum.autoCalendar.Year]) = Max({1} TOTAL [datum.autoCalendar.Year])"}>} budget)

• Re: autocalender: problem with expressions

I'll respond to this by one sentence : Please Beck, don't use autocalendars Create ur own :

1) u'd have the full control of it

2) U'd not experience such weird behaviours (since u'll have the full control)

3)It's always better to have the full control

4)I'm repeating my self; but hope I've made my point

• Re: autocalender: problem with expressions

Hi Omar,

thanks a lot for your time and Feedback, i take into account in it

thanks a lot