Trigger refresh on page load

Is there a way to automatically call a screen action if a local/input variable contains a particular value?


Background-  I am working on a report page.   I have a filter section that allows the end user to select a number of options and dates and then the wrapper contains web blocks with the report logic.   The filter section has each select tied to a refresh step that basically does an ajax refresh on the container that holds the web blocks so when the user changes a filter the properly report is displayed and the correct filter is passed to the web block.   This is all working wonderfully.

Now I am trying to link this to other modules in our application allowing other developers to pass parameters to this page so the proper report will be displayed.   For example, by default my page loads and displays a caseReport but I want to allow the remote module to send a parameter of eventReport and have that be the default web block displayed.

I have the parameters configured and everything is assigned as I would expect, but the web blocks are not automatically refreshing after the preparation runs.  I believe this is because the refresh step that is trigger when I manually change the report type in the filter box is not being kicked off.  


Any ideas?


Hi, 

Before of the refresh part, it sounds weird that the screen don't react properly, are the input parameters setted correctly? 

To triger the refresh, you can place a hidden button or link on the page (with display: none), and on the end of the preparation, trigger a widget click on that button. 

Best Regards, 

Hi,

Let me see if I understood.

Your filter options make a certain number of web block to show or not on the page. Is that how your page work?
And now, what you want is to allow the filter to be set using input parameters?

If so, use the InputParameters as the storage of the values of the Filter Options.

This way, from the page or from outside the page, it should work automatically.
And of course, if you are using Session Variables to store the filter options, you can assign the values in the preparation and when the page is built the correct blocks will show.

Cheers.

Correct, I have a number of containers wrapped in If's that check the report type and display the section if that option was selected by the user.


I have debugged the preparation and I see the incoming parameters, they are correct and the local variables are being set but when the page loads none of the web blocks are displayed.  If I select the report type manually in the filter section then the refresh is trigged and the web block appears.   The local variable that holds the report type is created with a default reportType value so maybe I need to clear that because it may be conflicting with the input parameter assignment?

I have added a hidden button tied to my refresh screen action but I'm not sure how to automatically trigger the click action on that button?   


You don't need hidden buttons.

How are you "using" the input parameters?
Are you setting the Local variables with those values?
Could you put here a print of your Preparation with the assign where you set the values of the LocalVariables selected so we can take a look into it?

Cheers.

Eduardo Jauch wrote:

You don't need hidden buttons.

How are you "using" the input parameters?
Are you setting the Local variables with those values?
Could you put here a print of your Preparation with the assign where you set the values of the LocalVariables selected so we can take a look into it?

Cheers.

Sure, here is the assignment loop.   Since there is a 5 parameter limit I decided to use parameter 1/2 as my date inputs, parameter 3 is a pipe delimited list of optional parameters that allow the user to set 5 more values.  Parameter 4 is a Boolean to collapse the filter bar if the user has provided a specific reportType.  (I thought it would be cleaner if they don't see all of the options by default when a specific report is requested)




Ok...

So, this is strange...

Wouldn't be better to use Session Variables to control the definitions of the Filters (most used way) or at least store in database?

Why do you think there is a limit of 5 input parameters? The problem is not the number of parameters, but the size of the URL (that has a limit), and so, your list will create a potential problem, even being in a single parameter.

So, the local variables are "correct" after the cycle or just after the AssignInputs?
If not, did you pass through each assign inside the looping? Are they set correctly? The Local variable in the upper side of the = and the Input in the lower?

I found the issue.... it was a case sensitivity issues in the parameter assignment.   I set the combo box values as CaseReport, EventReport, etc... but I was sending my parameter as camelcase so the first letter was lowercase.  Once I corrected the case the proper report was displayed on page load.

Sorry for wasting your time... it was just a stupid oversight on my part.   

You didn't waste my time and I'm glad you found the problem. Still think you probably would be better using a different approach, though. 

Cheers

Eduardo Jauch wrote:

You didn't waste my time and I'm glad you found the problem. Still think you probably would be better using a different approach, though. 

Cheers

What would your suggestion be?  I'm very new to Outsystems but I'm trying to follow best practices.  I am using the GetEntryURL to allow other modules to call this as an external page and that is where the 5 parameter limit comes into play.   

I am going to revisit the session variables because it does make sense to store the selections in a way that will allow the user to navigate away and then back to the page.


Solution

If it makes sense that this page can be called from other modules, this means this is a generic interface. 

I would make it into a public Web block in a core module and any module that wants to use it just create a page inside itself and drag the blok to it. 

The pages wouldn't need so many inputs or at least you could use normal inputs/session variables inside the same modules. 

And you could use events to war the page from operations like a cancel or save that require navigating to other pages, delegating this task to the page. 

Cheers 

Solution

Thanks so much for the feedback.   I'm learning more and more each day.   I was thinking that using GetEntryURL was the best way to avoid circular references, but I see that it's really only a one way conversation so going the web block route would have been sufficient.