URLs in a repeater

I have to transfer a link URL in a repeater.
If I use a simple text field it works and It transfer all of URL(three),but, If I use a panel state it transfer only the first URL.
Why It’s happening??

If you want each row to have a link to a different page or URL, or even if only one row needs to link to a unique URL, you should have a column in your repeater dataset to store the reference page or external URL. Here is the Axure documentation for this:

https://docs.axure.com/axure-rp/reference/repeaters/#reference-pages-and-urls

If you want a widget in each row to link to the same URL every time you can just specify it normally in the Open Link action. If you have a dynamic panel with 3 states and thus 3 different widgets, each linking to a different URL–but no differences among the rows (e.g., a widget in State 2 will always link to google.com for each and every row) this same method will work also. If you have a unique URL to link to in each state and for each row, then you would need 3 columns in your repeater dataset to store all the possible URLs.

If this doesn’t make sense, then I recommend you upload your .rp file here. Then forum users can see just what you are trying to do and offer a solution for you.

Youmusic def_recovered (1).rp (347.6 KB)

In the page “Mahmood” I have a repeater with 3 different songs but It shows only the first song and not the other 2.
I made “set text” for the title and it works and for the panel state I made "open link to [[item.link_URL]] " but it shows only the first song

I’ve never tried loading a javscript call like this into a repeater, but I see a few problems with your attempt. First, your “link_URL” entries refer to different widgets:

  • ‘[data-label="++URL"]’
  • ‘[data-label="++URL1"]’
  • ‘[data-label="++URL2"]’

But you don’t have a widget named “++URL1”, nor “++URL2” --you only have “++URL”. That is why the second and third songs don’t get loaded–there is nowhere to put them. You could either create these extra widgets, or, since the dynamic panel named “++URL” is in your repeater, it would get repeated for each row, so that should be the only widget you need to refer to in your javascript ‘[data-label]’ reference.

Second, you use the dynamic panel’s Loaded event instead of the repeater’s Item Loaded event. Because it is in a repeater, this event likely won’t work correctly. You should use the repeater’s Item Loaded event to set properties for each row’s instance of this widget, just like you do for the Set Text action.

Third, (and this is minor) you don’t have to place the entire javascript call in each “link_URL” column. This can be done once in the Item Loaded event, and all you need in the dataset column is the actual URL of the audio stream.

These changes should work, but they don’t. i think because you are using javascript injection in a repeater, the javascript doesn’t work the way it normally would. i tried this and each row’s dynamic panel ended up with three copies of the song streams. All three songs do get loaded, and they play correctly, but they all show up in each row–and only the last row has them all visible.

The only way I could find to get this to work properly was to create 3 states in the dynamic panel, each state containing a nested dynamic panel, then load one audio stream per row and change the dynamic panel state accordingly. This loses the elegance of a repeater, but it does work.

See this updated file:
Youmusic def_recovered (1).rp (359.7 KB)

Excuse me…but I have an other problem… I insert other songs in my project but it doesn’t work well because when I tap “Salva” that means “Save” I only save 3 song of first repeater and 5 songs (in order) of second repeater.
I don’t know why it doesn’t work because I wrote the same code for each songs.
Can you help me??

Youmusic def_recovered (1) (1) (2).rp (422.2 KB)

In your case logic for rows 6 and beyond, you have included a space before the first value, as in:

" [[Item.Title1]]"

instead of:

“[[Item.Title1]]”

Removing this space in each conditional case fixes this. That said, using a different global variable for each row in a repeater is very inefficient and kind of eliminates the power of the repeater. If you do not need to keep track of which rows (songs) have been saved in other pages, then you don’t need these global variables at all. If you do need to keep track of which songs saved, then using a single global variable for this is much more efficient, as you don’t need to test for every possible song name each time something is clicked. You can just append the value of [[Item.Title1]] to a global variable value when “Salva” is selected and remove it when unselected. More efficient yet would be to use a hash for the song/row, for example the order of the song ([[Item.index]]) or an abbreviation of the song title.

Thank you! It works!
But If I want to create an other artist and I want to save his songs in “Playlist” It doesn’t work.
Playlist shows only songs’ second artist or songs’ first artist.