Good afternoon first of all, I'm trying to use the function to sum the values of a column of the content manager, but when executing the code I get this error
export function Sum_Buenas(){ var idproy =$w('#text9').text; const filter = wixData.filter().eq("IDProyecto", idproy); wixData.aggregate("MYSQL/RepSerial_tbl") .filter(filter) .group("IDProyecto") .sum("BUENAS", "totalBuenas") .run() .then( (result) => { var totalB = result.items[0].totalBuenas $w('#text37').text = totalB.toString() }) .catch( (error) => { let errorMsg = error.message; let code = error.code; })}
this is the error
![](https://static.wixstatic.com/media/a27d24_bf0a7deb38ba40caa342b66d421e1319~mv2.png/v1/fill/w_49,h_2,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/a27d24_bf0a7deb38ba40caa342b66d421e1319~mv2.png)
![](https://static.wixstatic.com/media/a27d24_be336f76b3ad43949aac3d596d354ff1~mv2.png/v1/fill/w_59,h_7,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/a27d24_be336f76b3ad43949aac3d596d354ff1~mv2.png)
1. I'll assume you import wixData, If not - you should do it
2. I'll assume you call this function from $.onReady and inside dataset.onReady if the text is retrieved from data collection. If not - you should do it.
3. You're using field labels instead of field keys. Field key never starts with a capital letter.
4. No need to use 'export'.