2 Replies Latest reply: Apr 20, 2012 5:39 PM by Prakash Elumalai RSS

Pass value from Input box to script after reload

Prakash Elumalai

I want to pass user defined value to create another varable in the script.In other words, the variable in the script shud dynamically change calculations based on user input.

 

Thanks for the help.

  • Pass value from Input box to script after reload
    swuehl

    Maybe this system function is of interest for you

     

    Input(str cue [, str caption])

    This function can be used in the script only and opens an input box that prompts the user for a value during the script execution. The parameters cue and caption are used as message and caption texts, respectively. The function returns the entered value.

    The input box function returns NULL if the dialog is cancelled, closed or cannot be shown.

     

    Example:

     

    Load
    Input('Enter value', 'Input box') as v,
    Recno () as r
    autogenerate 3;

    • Pass value from Input box to script after reload
      Prakash Elumalai

      I am trying to solve for the code below

       

      sum({$<CalendarYear = {$(#=max(CalendarYear))}>} [Spend])) /

      sum(aggr(sum({$<CalendarYear = {$(#=max(CalendarYear)-1)}>} [Spend])) /

      sum({$<CalendarYear = {$(#=max(CalendarYear)-1)},CalendarQuarter=,CalendarMonth=>} Qty)) *

      sum({$<CalendarYear = {$(#=max(CalendarYear))}>} if(len(Subcategory)>0,Qty)), Material))

       

      On top of this I want to add the below condition for spend in the numerator (highlighted in red):

       

      Calculate spend in current year only when Material exists in "max(CalendarYear)-1" so I wanted to use an aggr function in Numerator?

       

      I tried addressing this by passing a value from input box to a variable in the script, kindly help.