sakalabattulakoteswa

sakalabattulakoteswa

  1. Hi everyone

  2. I have 3 collections one is Showcast collection and another People & CastRoles collections.i am creating reference fields in showcast collection from those reference fields are one peoples collection in person id and CastRoles collection in Role id.

=>Design part is find out below screen shot

  1. This is showcast collection in creating reference fields.

=> This is Peoples collection

=> This is CastRoles collection

  1. =>  i am using below code adding reference filed’s :

  2. $w(‘#submit’).onClick(() => {

  3. let a = $w(‘#RolsSelection’).value;

  4. let b = $w(‘#Person’).value;

  5. let c = $w(‘#ShowId’).value;

  6. wixData.aggregate(‘ShowCasts’) .group(‘title’) .avg(‘title’).descending(‘title’) .run() .then((res) => {

  7. let item = res.items[0];

  8. maxid = item._id;

  9. console.info (maxid); maxid++;

  10. $w(“#showcastdataset”).setFieldValue(“title”, maxid); $w(‘#showcastdataset’).setFieldValue(‘roleId’, (a)); $w(‘#showcastdataset’).setFieldValue(‘personId’, (b)); $w(‘#showcastdataset’).setFieldValue(‘showId’, (c)); $w(‘#showcastdataset’).save(); })

//submit.onclick

  1. })

  2. })
    => according to above code output like this way.please check the below screenshot.

  3. But i don’t want to like above output ,no need to [reference is broken ] i want to adding the number only.

  4. i)   I try to find out the solution using below code please check these 2 screenshots:

  1. =>according to above code ,i got output output like this find out below screen shot

ii) I tried on  Another way using this below code:but it’s not working.

=>  Finally i want to like this way of OUTPUT in below screen shot.please give me any suggestions (or) send me if you have any examples.i hope i am getting a positive response form your’s.Thanks for your valuable time spending on above issue.

Thanks & Regards
koteswara rao.
]

Hi
how to use sub queries working with three collections