Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
nikhilgarg
Specialist II
Specialist II

How to get selected value of field in Script ??

How to get selected value of field in Script ??

I tried GetCurrentField[FiscalYear] ; but it does not work out.

Thanks

1 Solution

Accepted Solutions
Peter_Cammaert
Partner - Champion III
Partner - Champion III

BTW try this expression:

If (_CalendarType = 'Fiscal' , GetFieldSelection([Fiscal Year]), if (GetSelectedCount(_CalendarType) = 0, $(vSalesBookUsage)))


If SalesBookUsage is a field (i.e. an Amount) put an aggregation expression in vSalesBookUsage, like


SET vSalesBookUsage = 'Sales Book Usage = ' & sum(SalesBookUsage);


or define something similar in the Variable Overview.


Best,


Peter

View solution in original post

16 Replies
its_anandrjs

Try With

=Getfieldselections( [FiscalYear] )

Regards

Anand

northerner
Partner - Contributor III
Partner - Contributor III

Hi Nikhil,

GetCurrentField works on groups - the parameter should be a group name.  It does not operate on fields (the function name is not particularly clear)

Have you looked at the syntax for getfieldselections()?

Hope this helps!

Ralf-Narfeldt
Employee
Employee

GetCurrentField can't be used in a script.

It can only be used in chart expressions in the UI.

nikhilgarg
Specialist II
Specialist II
Author

Hey,

It works but now i want if nothing is selected in _CalendarType then SalesBookUsage should be visible in straight table caption. How can i acheive this??

My script is:

If(_CalendarType = 'Fiscal' , GetFieldSelection([Fiscal Year])).

thanks

nikhilgarg
Specialist II
Specialist II
Author

Hey,

It works but now i want if nothing is selected in _CalendarType then SalesBookUsage should be visible in straight table caption. How can i acheive this??

My script is:

If(_CalendarType = 'Fiscal' , GetFieldSelection([Fiscal Year])).

thanks

its_anandrjs

Hi,

Use variable here try dynamically store the SalesBookUsage value in the variable and then use it here in the variable.

Ex:-

If(_CalendarType = 'Fiscal' , GetFieldSelection([Fiscal Year]), $(vSalesBookUsgae) ).


Also it does not seems your expression works in getfieldslection condition check once but you deleted the eariler messsage on that i explain the correct way to use the getfieldselections().


Ex:- Like this ways

if( GetFieldSelection(_CalendarType) = 'Fiscal' , ([Fiscal Year]), $(vSalesBookUsgae) )


Regards

Anand

nikhilgarg
Specialist II
Specialist II
Author

Hey ,

Thanx anand but still my problem is not solved.

My expr is like:

=if(_CalendarType = 'Fiscal' , GetFieldSelections([Trade Fiscal Year]) & '-' & GetFieldSelections([Trade Fiscal Quarter]) ,

if(vTradeCalendarDateType = '1D' , date(max({1}TradeDateMaster), 'MM/DD/YYY') , $(vSalesbookUsage))

)  Now when i select any date, in my table caption date is visible but when i clear everything then still last selected date is there. But i want when i clear everything , SalesbookUsage should be visible.

What to do??

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Nikhil,

you're talking about expressions, not about any script. With script, people refer to the load script as presented in the script editor (File->Edit Script...) That's an entirely different ball game.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

BTW try this expression:

If (_CalendarType = 'Fiscal' , GetFieldSelection([Fiscal Year]), if (GetSelectedCount(_CalendarType) = 0, $(vSalesBookUsage)))


If SalesBookUsage is a field (i.e. an Amount) put an aggregation expression in vSalesBookUsage, like


SET vSalesBookUsage = 'Sales Book Usage = ' & sum(SalesBookUsage);


or define something similar in the Variable Overview.


Best,


Peter