-
Hi everyone
-
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
- This is showcast collection in creating reference fields.
=> This is Peoples collection
=> This is CastRoles collection
-
=> i am using below code adding reference filed’s :
-
$w(‘#submit’).onClick(() => {
let a = $w(‘#RolsSelection’).value;
let b = $w(‘#Person’).value;
let c = $w(‘#ShowId’).value;
wixData.aggregate(‘ShowCasts’)
.group(‘title’)
.avg(‘title’).descending(‘title’)
.run()
.then((res) => {
let item = res.items[0];
maxid = item._id;
console.info (maxid);
maxid++;
$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
})
}))
$w(‘#showcastdataset’).save();;
$w(‘#showcastdataset’).save();
})
//submit.onclick
})
}))
});
$w(‘#showcastdataset’).save();
})
//submit.onclick
})
}))
//submit.onclick;
$w(‘#showcastdataset’).save();
})
//submit.onclick
})
}))
});
$w(‘#showcastdataset’).save();
})
//submit.onclick
})
}))
});
$w(‘#showcastdataset’).save();
})
//submit.onclick
})
}))
=> according to above code output like this way.please check the below screenshot.
-
But i don’t want to like above output ,no need to [reference is broken ] i want to adding the number only.
-
i) I try to find out the solution using below code please check these 2 screenshots:
- =>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
koteswararao










