How I exchange data between classes in the same database? I have one class called âArticle Listâ where I store all the articles and in â_Userâ class I have a column called âUser Articlesâ so when a purchase is done the article in Article list moves to User Articles, but I donât know how to do that, I tried to do a user.set(âUser Articlesâ, new_article) but that would delete the articles that rhe user had before, thanks for your time.
Hi,
You may want to create another class called âUser Articlesâ that has user and article as columns.
How is that going to solve my problem? I dont see how
Can you describe your problem better then?
I thought that if you create another class, you donât have to move anything if you would have a column specific to a user.
I want to add content to a column but without removing the content that it already has
and what kind of data has that column?
usually you can do that by reading the previous column data for a particular entry, concatenating the new data and adding the new resulted data as the final value to that entry
The column is an array
Something like this then: https://stackoverflow.com/questions/35517573/appending-data-to-an-array-in-parse-cloud-code ?
Yeah I tried concatetenating using this code:
async function add_random_article(){
let user = await Moralis.User.current();
let random_article = await randon_article();
let attributes = [user[âattributesâ][âArticlesâ] + random_article];
user.set(âArticlesâ, attributes);
user.save();
}
âArticlesâ column is an array, and when I do this it only displays other type of data
Yes that is what i am looking for, Thanksss