Hi ,

From one screen to other screen we can pass variable as inputparameter, but how to pass inputparameter to menu from home screen in outsystems mobile.

Thanks

Harish

Hi Harish,

You have to pass parameters while creating menu in menu block.

If you want to send dynamic values from home screen to other screen while redirecting through menu then you should use client variables for that purpose.

Hi Nikhil,

I want to send variable from home to menu, when user click on hamburgermenu then i want to pass a variable to menu .

Thanks

Harish

Hi Harish,

Scenario looks strange, may I ask your use case so that I can understand your need and suggest best approach.

in my home screen i need a input variable for that purpose i need to pass. So thats the reason i want to pass same variable when the user clicks on the menu, if i pass the same variable then i'll get the same so for that purpose i need this.

Thanks

Harish

Solution

Hello Harish,

The Menu is a block, used by the Layout, that by its turn, is used on your page.

So, you need to propagate the information through the Layout instance in the page (using Input Parameter on Layout block), to the Menu instance in the Layout (through input parameter on Menu block).

You can, of course, use the OnParametersChanged event, but it is not necessary if you only want to show and pass things along the way (like in my example).

Basically, every time you change the variable in the page (the one associated with the input parameter in the Layout), it will propagate the value to the Menu.

Cheers.


Solution

Yes, that is why I was asking the use case.

So what you can do this is when you enter any value in input you can save that in a client variable of the application. Client variables are used to store data that can be used in complete application like context data etc.

Now there is no need to pass the parameters from menu link. On your other screens you can simpaly check if client variable value is set then use that instead of parameters.

P.S.

It is "weird" to have menus that navigate to screens that you need to pass input parameters...
But if you really need this, you can use the approach I sent you. You use the input parameter in the menu as the value to the input parameter in the link, at the Menu.

Cheers.

P.S. 2

If (the feature is) available at your server, you can also use client variables instead of passing through input parameter (I think it is more elegant).

Eduardo Jauch wrote:

Hello Harish,

The Menu is a block, used by the Layout, that by its turn, is used on your page.

So, you need to propagate the information through the Layout instance in the page (using Input Parameter on Layout block), to the Menu instance in the Layout (through input parameter on Menu block).

You can, of course, use the OnParametersChanged event, but it is not necessary if you only want to show and pass things along the way (like in my example).

Basically, every time you change the variable in the page (the one associated with the input parameter in the Layout), it will propagate the value to the Menu.

Cheers.


Hi Eduardo,

I have one question with this approach. Don't we have to pass the parameters on each screen in this case?


You can set the Input parameter is marked as Is Mandatory = No.

But it will be present in all the screens using this layout.

The problem, to me, is that does not make sense to have a link, in the menu, to a page that needs an input parameter. No matter if you solve the problem through parameters or client actions.

The question is that if it needs information from a previous screen, it needs a certain context, that will not be available all the time... 

And this creates a navigation problem...

You should navigate to a Screen that needs a specific context only from the right context. The menu is global (no context).

Hi Eduardo,

Thanks for reply, but in my case i want to pass a variable from home to menu then from their again i need to pass according to userclick layout. But the example which is shared is not showing how to pass a variable from home screen to Menu.


Thanks

Harish

Eduardo Jauch wrote:

You should navigate to a Screen that needs a specific context only from the right context. The menu is global (no context).

Hi Eduardo,

Agree with you that menu is global without context.

Harish,

The example uses Input parameters. On in Layout, and one in Menu. From the page, pass a value to the input parameter in the Layout, that is used to pass a value to the Input parameter of the Menu.

But you shouldn't use this approach.

Menus to navigate to screens that require Input Parameters are simply wrong, IMHO.

If you are in a screen and needs to navigate to a different one, use a link/button in the origin screen and then you just pass the values you need to pass to the other screen. 

Do not add a menu to the screen that needs a context...

Cheers.

Hi Eduardo,

Hamburger menu items require input parameter,  where destination screens are in  need of that parameter., how to get required parameter back and forth in this case.

Thanks

Harish

Hi,

1. Do not create menus to pages that require input parameters. This is the best approach.

2. The example attached before shows how to send information to the menu. If you really want to go that way, you use the input parameter from the menu to feed the link (in the menu), that navigates to the new screen.

What happens is that in page A, you feed the Menu with the value passing the value to the Layout, that pass to the Menu, that automatically updates the Link (if the link is using this input parameter), without you having to do anything besides setting up the values for the input parameters, and when the user clicks the link, the new page will receive this value.

Cheers

Hi Eduardo,

thanks i am getting data as required(Here in our case we need to call API for that purpose we require inputparam when user click on the menu).

Can't we maintain device specific database in outsystems.


Thanks

Harish