Hi,
I set a page has a Dynamic Page and did some stuff… it created a new column with the field name of “link-Jogos-title” wich I want to use in code, but I can’t use “-” in code and I can’t change the field name, how do I write that field in code?
Hi,
Whenever you create a column to your DB collection, you set the field name and the key field is created automatically, as you can see here:
If you wish to set / get the attribute of this field, you need to use the field key , and not the field name .
For example, if you create a query and wish to console log the column value of the first record with the key field " fieldKey ", you should do the following:
wixData.query("collectionName")
.find()
.then((results) => {
let firstItem = results.items[0];
console.log(firstItem.fieldKey);
})
.catch((err) => {
let errorMsg = err;
});
In order to check the field key of an existing column, you should click on the header of the DB table → manage properties.
Good luck!
Tal.
I know that all, but the field key has been created automatically and it has those characters
Hey,
Can you send us the editor URL / site URL and specify the name of the collection so that we can have a look?
Thanks,
Tal.
Collection name is “GamesData”
I couldn’t find any field named “link-Jogos-title” of this collection. I’m not sure that I fully understand what you were referring. Please send us a screenshot of the field key you were referring.
Thanks,
Tal.
Have you find it already?