Click on row in table record and trigger an event and capture value

Click on row in table record and trigger an event and capture value

  

Hi, i have a list of countries in table records as per below which is in a pop up page(screen 1).

The user can select the countries on the table records by clicking on it and an event is triggered.In the triggered event, the countries name is captured into a variable.

I have tried 3 ways to triggered event in table records by (screen 2)

1.Adding a button in the table records

2.Adding a picture to the table records and it is embedded in a link

3.Adding a container to the table records and the expression is embedded inside it.

I manage to trigger the event but not able to capture the selected country name.I call  the code as per below assign it to a local variable "SelectedValue".The value returned is always "".None of the 3 approach is working.

SyntaxEditor Code Snippet

CountryTable.List.Current.Country.CountryName

Does anyone has idea on this? Help

                                                               Screen 1

                                                                             Screen 2


                                                        Screen 3

Hi,

On the action of the Button include an input variable and to that variable assign the 

CountryTable.List.Current.Country.CountryName

Regards,

Marcelo

Hi Marcelo,

The value of the code is always empty("").Do you have any idea?

CountryTable.List.Current.Country.CountryName

Hi,

I don't see an input variable on Select. Did you try what i suggested? Create a input variable on Select, assign CountryTable.List.Current.Country.CountryName to that input and then assign the input variable to the SelectedValue

Regards,

Marcelo

Hi Johnson and Marcelo

Every time you click on a line in a Table Records, the table copy the line content to the Current of the list in that table, that you have access in a screen action if the element clicked have a link to that screen action.

So, no need to use an input variable in the action.

Johnson,

I noticed that you are with the debugger on. Is that right? If so, are your affirmation that the value is always empty originated on your observation of the variable content in the debugger?

If so, a little advice/reminder may be useful here.

The code is optimized by the server. This means that any code that relays on variables that are not used anywhere will be removed from the final code.

If your variable SelectedValue is not being used anywhere, like to send a message through notify, the compiler will not use it, and debugger will always show an empty value.

If you actually use the variable, it will start to show values in debugger.

Hope this helps.

Cheers

Eduardo Jauch

Solution

Hi Johnson,

After assigning Current country name into local variable you need to use this local variable if you use this variable then you can see the current value into local variable.


Screen: 1

Screen 2: 


Please try it and if you still facing problem please let me know I can send you sample oml.


Regards

-SK-

Solution

Hi Eduardo,

So when you aren't using the value you prefer to use an input on the action or you just put the value to the screen hidden?

Regards,

Marcelo

Hi Marcelo,

I didn't understand.
If you aren't using the variable, why bother with it? :)

The problem I'm seeing here is that if you do an assign of a field of the current to a variable, but do not use this variable, the compiler will not execute this assign. 

Than, in debugger, you will not see the value in the current or in the variable (because you are not using it, and the compiler removed this from the code.

If you send the variable through a Notify to the parent, for example, than you start "using" the variable. And now, the code will not be removed by the platform compiler and when debugging, you start to see the value.

Cheers,
Eduardo Jauch

Hi Johnson,

If problem is fixed please marked the solution as resolved, it will be helpful for others.


Regards

-SK-

Hello Johnson Lim,

If I understood it well, you are using the list in a Popup and you want to click on the list to notify the parent page. If this is the case,you don't need the popup local variable but a "notify" from the popup to the parent page with the country you selected. 

I would like also to advise you that normally, using names or descriptions is not the best choice. You should keep the strategy with identifiers or unique codes. For countries maybe the name is unique but I would not recommend to implement it as a generic strategy.

Regards

Thanks Eduardo,Shashi,Miguel and Marcelo.

Really appreciate the overwhelming help!!