Hi all!
I currently use the code below to combine the coded text “DIT WIL JE DOEN” with the description, imported from the database field “titel” in 1 text element (text569). I was wondering whether I can combiner multiple database fields into 1 text element. I tried duplicating the row starting with “let” but that doesn’t work.
Thanks so much!
$w.onReady( () => {
$w( “#dynamicDataset” ).onReady( () => {
let description= $w( “#dynamicDataset” ).getCurrentItem().titel; //text is the field you want to get its text
$w( “#text569” ).text = "DIT WIL JE DOEN IN " + description ;
} );
} );
You can certainly use multiple fields. First get the current item, and then get each field that you want. Something like this:
$w.onReady( () => {
$w("#dynamicDataset").onReady( () => {
let item = $w("#dynamicDataset").getCurrentItem();
let field1 = item.field1;
let field2 = item.field2;
$w("#text569").text = "DIT WIL JE DOEN IN " + field1 + " " + field2 ;
} );
} );
Awesome, thanks so much it works! I have an aditional question; how would the code look like if field1 and field2 come from different datasets?
Thanks so much!
Just use the same principles…
let item1 = $w("#dataset1").getCurrentItem();
let field1 = item1.field1;
let item2 = $w("#dataset2").getCurrentItem();
let field2 = item2.field2;
$w("#text").text = "blah blah blah " + field1 + " " + field2 ;
Thanks so much! I’m a beginner, these examples help a lot in understanding the possibilities with code!