7 Replies Latest reply: Nov 26, 2016 5:05 AM by vineeth pujari

# GetField Selection in YTD

Hi All,

I have used get selection with if condition in my variable. Variables are giving desired vales when put individually (Without using = sign).

but while taking in range it fails.

Need Suggestion

vYearStart= If(GetfieldSelections(Month)<=1,(Yearstart(Max(Date),0,4)),

(IF(GetFieldSelections(Month)>1,(MakeDate(Year(Max(Date)),Month(Min(Date)),01)),(Yearstart(Max(Date),0,4)))))

vYearEnd= If(GetFieldSelections(Month)>0, Date(MonthEnd(Max(Date)),'DD/MM/YYYY'), Date((Max(Date)),'DD/MM/YYYY'))

Range : '>=vYearStart<=vYearEnd' : No Result on using Range.

YTD = Sum({<Date={'>=\$(vYearStart)<=\$(vYearEnd)'}>}Qty) : No Result.

• ###### Re: GetField Selection in YTD

what is your vYearStart incase user selects more than 1 month??

I would prefer using a master calendar for simpler calculations

Year = {'\$(=Max(Year))'}

Month= {'<=\$(vMonth)'}   where vMonth = your Month Selection!

• ###### Re: GetField Selection in YTD

Hi Vineeth,

In case of more than one selection :

For Example I have Selected : May & June the my vYearStart is 01/05/2016.

Ques : Ideally If i ll select a month in YTD will it give me the result of that particular month or till that month ?

• ###### Re: GetField Selection in YTD

can you post sample app?

Check using one variable at a time

Sum({<Date={'\$(vYearEnd)'}>}Qty) << does this evaluate?

Sum({<Date={'>=\$(vYearStart)'}>}Qty) << does this evaluate?

• ###### Re: GetField Selection in YTD

Sry, Cant fetch the data out.  I ll try to create the sample !!

Meanwhile, can you tell me , is there any limitation of using if condition in the variable ?

• ###### Re: GetField Selection in YTD

Nope, no limits

• ###### Re: GetField Selection in YTD

Single variable doesnot give any result over Sum.

• ###### Re: GetField Selection in YTD

Then the variables are the problem

try

Sum({<Date={'>=\$(=vYearStart)<=\$(=vYearEnd)'}>}Qty)

or

Sum({<Date={'>=\$(=DATE(\$(vYearStart),'DD/MM/YYYY'))<=\$(=DATE(\$(vYearEnd),'DD/MM/YYYY'))'}>}Qty)

or

Sum({<Date={">=\$(=DATE(\$(vYearStart),'DD/MM/YYYY'))<=\$(=DATE(\$(vYearEnd),'DD/MM/YYYY'))"}>}Qty)