Hy to everyone,
I searched for various solutions, I tried to write this code using insertReference. It does not report errors, but it does not work.
I simply have to read the IDCode field present in the collection A (DTS2) and write it in the same field referenced in the collection named “AssociativeSpace”.
Can you help me please?
Thanks in advance as always
export function BServiceOnline_click(event) {
let CompanyCode = $w(" #DTS2 ").getCurrentItem().IDCode wixData.insertReference(“AssociativeSpace”, “IDCode”, “” , CompanyCode)
.then(() => {
console.log(“Reference inserted”);
}) }
First of all, please make sure that the field keys that you are referencing match the ones in the code. In addition, I can see that our field key (IDCode) starts with a capital letter, which is not recommended in this case.
I can also see that you have left the referring item argument empty, which means that you are currently not inserting your data anywhere. Please make sure to follow the correct syntax as it is described here: https://www.wix.com/corvid/reference/wix-data.html#insertReference
Hi #Angelina Kravchenko,
Thanks for your reply, the data is correct and verified.I saw the API reference, but I don’t understand it.
To be more precise:
“Movies” is the collection where the reference field is located or the destination field?
“Actors” same doubt as before
“0000”, “12345” are specific fields or field names?
I also tried using Insert, Save, update, and wixdata, but I always get the same error. when I used code to insert information in a simply field the code works goood, but with the reference field always is “reference broken”
Can you give me a hand more? Thank you very much
Did your problem solve? In fact I am also facing similar one… and the documentation is confusing…