242
Views
7
Comments
Solved
Get ListRecord ID on click of gallery item

I've got a gallery item with list records, which I'm able to populate how I want to. OnClick of an items I need to be able to grab the Id of that record & update a table. I'm fine with the updating, just coming stuck at getting the Id of the record that I'v clicked. Structure below. ThemeRecords is the name of my ListRecord.

On Click event of my container 

In debugger the input variable In1 always has a blank value (appreciate it's currently set to Theme_Hdr rather than Id, it's just so as I can return something I recognise, rather than an integer....)


Any idea where I'm going wrong?

2020-01-29 14-47-45
Filipe da Silva
Solution

Steve Webb wrote:

Filipe Silva wrote:

So you have the GetOPThemes aggregate, you have it bound to the ThemeRecords Record List.

The container with the OnClick must be an Item of the Record List, and not the full Record List.

Populate the In1 input ThemeRecords.List.Current.OPTheme.Id, it should be in the Widgets expandable section.

Make sure that GetOPThemes is actually returning Ids.



Sample OML attached for my current set up.

This a "bug" in the debugger I believe because of the way outsystems optimises screen and screen action variables. It is working, we just can't see it!

I've attached a working OML

Try it:

- create a Screen variable and an input on the webscreen that show it's value

- in the OnClick action assign ListRecords.List.Current.StaticTable.Id (no need for input parameters) to the new variable

- in the OnClick action refresh the input that shows the new variable

You will see the Id you want is there


Hope it helps!


GalleryOnClickfil.oml
2020-01-08 12-23-57
Jitender Gaur

Hi Steve, 


Are you using any client action or destination method after clicking on the container?  and  which type of application you are using?  

2020-01-29 14-47-45
Filipe da Silva

So you have the GetOPThemes aggregate, you have it bound to the ThemeRecords Record List.

The container with the OnClick must be an Item of the Record List, and not the full Record List.

Populate the In1 input ThemeRecords.List.Current.OPTheme.Id, it should be in the Widgets expandable section.

Make sure that GetOPThemes is actually returning Ids.


UserImage.jpg
Steve Webb

Filipe Silva wrote:

So you have the GetOPThemes aggregate, you have it bound to the ThemeRecords Record List.

The container with the OnClick must be an Item of the Record List, and not the full Record List.

Populate the In1 input ThemeRecords.List.Current.OPTheme.Id, it should be in the Widgets expandable section.

Make sure that GetOPThemes is actually returning Ids.



Sample OML attached for my current set up.

GalleryOnClick.oml
2020-01-29 14-47-45
Filipe da Silva
Solution

Steve Webb wrote:

Filipe Silva wrote:

So you have the GetOPThemes aggregate, you have it bound to the ThemeRecords Record List.

The container with the OnClick must be an Item of the Record List, and not the full Record List.

Populate the In1 input ThemeRecords.List.Current.OPTheme.Id, it should be in the Widgets expandable section.

Make sure that GetOPThemes is actually returning Ids.



Sample OML attached for my current set up.

This a "bug" in the debugger I believe because of the way outsystems optimises screen and screen action variables. It is working, we just can't see it!

I've attached a working OML

Try it:

- create a Screen variable and an input on the webscreen that show it's value

- in the OnClick action assign ListRecords.List.Current.StaticTable.Id (no need for input parameters) to the new variable

- in the OnClick action refresh the input that shows the new variable

You will see the Id you want is there


Hope it helps!


GalleryOnClickfil.oml
UserImage.jpg
Steve Webb

Filipe Silva wrote:

Steve Webb wrote:


This a "bug" in the debugger I believe because of the way outsystems optimises screen and screen action variables. It is working, we just can't see it!

I've attached a working OML

Try it:

- create a Screen variable and an input on the webscreen that show it's value

- in the OnClick action assign ListRecords.List.Current.StaticTable.Id (no need for input parameters) to the new variable

- in the OnClick action refresh the input that shows the new variable

You will see the Id you want is there


Hope it helps!


HA! it was there all along - I should have tried writing it back to the screen.....


Thank you for your help!


UserImage.jpg
Steve Webb

It's a traditional web app. After on click it's just a screen action, & I've got a breakpoint in to view the values of local variables.


@Filipe Silva - How do i check the container an item of the record list?


2020-01-29 14-47-45
Filipe da Silva

No problem! 

Don't forget to mark the solution so that other people will see it in the future

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.