You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This errors saying "cat2" does not exist in Category. How do you write such rules?
The text was updated successfully, but these errors were encountered:
alok87
changed the title
Map Key Does Not Exist - Errors - How to do this?
Map Key Does Not Exist - Errors - How to write such rules with maps?
Jul 21, 2023
There's a small mistake in your provided example - you populate the Category map with a key cat1 but appear to be checking for cat2 in your rule.
Regardless, this should work. You can access properties on structs in maps as expected. One key note is that this does not work for maps to interfaces! i.e. map[string]fact.Category is fine, but map[string]interface{} is not. However map[string]interface{} will work for basic types (int64 / string / bool / float64).
Simple things to check:
that your keys do match
you are using the correct name for your fact (as it was added to the DataContext)
Fact
Rule
Fact.Category["cat2"].ItemCount > 5
This errors saying "cat2" does not exist in Category. How do you write such rules?
The text was updated successfully, but these errors were encountered: