Replacement of string in a repeater

Trying to substitute an actual name for the string (Student’s Name) in a paragraph text within a repeater. Have looked in the forum and tried to implement but not seeing anything take place.

Is this an ordering problem? #dataset11 is the contents for the repeater #repeater1 in this example. I am obtaining the right name to substitute, but not seeing anything happen. Have tried various quotes and even tried a simple replacement, story for elephant, but no joy that I can see when previewing.

Any insight would be GREATLY appreciated.

Thanks!

Deborah

$w . onReady ( function () {

$w ( “#dataset11” ). onReady (() => {

$w ( "#repeater1" ). onItemReady ( ( $item ,  itemData ,  index ) => { 

$w ( “#repeater1” ). forEachItem (( $w , itemData , index ) => {

**const**  name  =  $w ( '#dynamicDataset' ). getCurrentItem (). title ; 
console . log ( "name is" , name ); 
$w ( "#text132" ). text . replace ( /(Student's Name)/ **g** ,  name ); 
$w ( "#text132" ). text . replace ( "story" ,  "elephant" ); 
console . log ( "replacement text is" , $w ( "#text132" ). text ); 

});
});
});

});

Hi @deborahsavage1 ! It looks like you are using the correct syntax to replace the text in the paragraph within the repeater item. You need to assign the updated text back to the element’s text property, as the .replace() method returns a new string. Additionally, you can remove the forEachItem loop as the onItemReady callback function is already iterating over the repeater items. If you make the changes I suggested and are still experiencing issues, I recommend providing more details about the problem you’re facing, including any error messages you’re seeing and any additional relevant code or setup information. Good luck!

$w.onReady(()=> {
  $w("#dataset11").onReady(()=> {
      const name = $w('#dynamicDataset').getCurrentItem().title;
      console.log("Name: ",name);
        
      $w("#repeater1").onItemReady(($i,iData,index) => {    
            
      });

      $w("#repeater1").forEachItem(($i,iData,index) => {
          $i("#text132").text.replace(/(Student's Name)/g, name);
          $i("#text132").text.replace("story", "elephant");
          console.log("replacement text is",$i("#text132").text);
      });
  });
});

Already tried like this one…?

And still the question → is your dynamic-dataset already ready at this point ?