Is there a way to filter records in a count() statement by searching for an integer ID value in a multiselect field? Zoho is giving me trouble on this. Here's the use case:
- Form "Asset" has a multiselect lookup field, "Tags", that holds record ID values from a related form, "Tag_List". Various string tags can be assigned to each Asset to describe it, e.g. Asset "Sales brochure" might get tags "sales" and "collateral". The Tag_List form is the master list of all tags.
- I want to create a simple text string, suitable for display on a page, that shows a list of all tags, with the count of assets referencing each tag beside it. E.g.
collateral: 3
sales: 11
- I've created a function that
iterates through Tag_List, grabs a record, then does a count of records in Asset whose Tags field (which appears to contain a list of record IDs from the related Tag_List table) contains my ID. But Zoho is not letting me do that. My code is simple:
string shared.get_asset_counts_by_tag()
{
Result = "";
for each aTag in Tag_List sort by Tag_text
{
nAssets = count(Asset[ aTag.ID in Tags ]);
Result = Result + aTag.Tag_text + ": " + nAssets;
}
return Result;
}
Zoho objects to the line with the count() by saying:
Field 'aTag' does not exist in form 'Asset'
Huh?
Putting "input." in front of aTag.ID doesn't cure it, nor does wrapping the select criteria in parentheses.
Can anyone tell me what's wrong here, or a better way to achieve the same?
TIA, zp