update Reference field automatically

I have two database in one dynamic page as shown in the image below.

The “Project name” field is the main field from the database called “Non-DMD”.

The grey box is another dataset called called “Non-DMD-C3” shown in the grey section below.

The “Non-DMD-C3” connected to “Non-DMD” through a reference field call “reference”. each “Non-DMD” will have multi “Non-DMD-C3” records.

All I want is to dynamically update the refrence without selecting it from the dropdown field (see the mark-up circle) or do it manually from the database. The reference should automatically be same to the project name.

I managed to update the field automatically through the code below, but still can’t save the value back to the database.

$w("#repeater").forEachItem( ($w, itemData, index) => {
$w("#dropdown").options = [{"label": $w('#projectname').value, "value": $w('#projectname').value}];
$w("#dropdown").selectedIndex =  0;

Any help about how to save this value back to the database ?

Thanks,

Hey @wisam-tozah !

Could you please share what is the method you’re using in order to update the specified field?
And maybe post a link to the said page? (Only authorized personnel can inspect your site).

Doron.