Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Pass value from Input box to script after reload

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.

2 Replies
swuehl
MVP
MVP

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;

Not applicable
Author

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.