You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i want to set pl for each of partnerships object multiplied with amount field of main object.
if i run below query then it is updating array
UPDATE records SET partnerships.pl = amount * 100
but if i run below query
UPDATE records SET partnerships.pl = amount * partnerships.amount
"Cannot perform multiplication with '400f' and '[800f, 800f, 800f, 800f]'"
even i tried this one also
UPDATE records SET partnerships.*.pl = amount * partnerships.*.amount
"Cannot perform multiplication with '400f' and '[800f, 800f, 800f, 800f]'"
for now i am looping throgh partnerships and updating value.
FOR $record IN (SELECT * FROM records) {
LET $partnerships = $record.partnerships;
FOR $partnership IN $partnerships {
$userId= $partnership.user_id;
UPDATE $record.id SET
partnerships[WHERE user_id = $userId][0].pl = amount * partnerships[WHERE user_id = $userId][0].amount) WHERE partnerships[WHERE user_id = $userId]
}
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
i want to set pl for each of partnerships object multiplied with amount field of main object.
if i run below query then it is updating array
UPDATE records SET partnerships.pl = amount * 100
but if i run below query
UPDATE records SET partnerships.pl = amount * partnerships.amount
"Cannot perform multiplication with '400f' and '[800f, 800f, 800f, 800f]'"
even i tried this one also
UPDATE records SET partnerships.*.pl = amount * partnerships.*.amount
"Cannot perform multiplication with '400f' and '[800f, 800f, 800f, 800f]'"
for now i am looping throgh partnerships and updating value.
but i want single query to update inner array.
can anyone help me to fix this? @tobiemh @kearfy
Beta Was this translation helpful? Give feedback.
All reactions