Dataset reference via code

I want to know how to use reference field using wix code and gel total count of that filtered field.
For example there is member database and a submission database. Now i can show each user posts using their email as the key on their profile now i need to show how many post they made on their profiles.

Hi Amit,

lets try and figure this out. To get a count it is best to use Wix Data API.

I assume your model looks something close to this - each submission holds a reference to a member who submitted the data (I will call this field submittedBy ). So, if you want get a count of posts by a certain member you would:

wixData.query('Submissions')
    .eq('submittedBy', memberId)
    .count()
    .then(numberOfSubmissions => console.log('Number of submissions: ' + numberOfSubmissions);

You can find Wix Data API documentation here:

Let me know if you have further questions. Good luck!