Hi there,
I need some advice.
Previously I have created 2 field in the database which contact Game01 & Game02. Then I realize that I want to add them together.
I created a new field called “Total Pin” and add a hook on it.
for new entry, it does the job of added Game01+Game02 into Total Pin. But for my previous data it seems i can’t do the calculation.
I’m not sure whether to start. can someone guide me?
Many Thanks
Raymond
I just did something similar in an afterQuery hook. i concatenated two fields into a new database field. the new field did not populate until i pushed it live and visited the page. it would probably be something like this for you in BACKEND > data.js.
export function DATABASENAME_afterQuery(item, context) {
item.TotalPin = item.Game01 + item.Game02;
return item;
}
Hi Andrew,
Thank you and it works.
one more question, how can I put 2 decimal points and , ?
Cheers
Raymond