Hi @sdirix ,
I was wondering if you can provide an example of a rule that translates the following.
If ((Q1 = 2 and Q3 > 5) or (Q4 > 5 and Q5 > 10)) == true, show Q5
Cheers,
Chat,
Hi @sdirix ,
I was wondering if you can provide an example of a rule that translates the following.
If ((Q1 = 2 and Q3 > 5) or (Q4 > 5 and Q5 > 10)) == true, show Q5
Cheers,
Chat,
Hi,
I’ve created the following rule. However it does not work as expected. Please help.
Cheers,
Chat.
{
"effect": "SHOW",
"condition": {
"scope": "#",
"schema": {
"allOf": [
{
"anyOf": [
{
"allOf": [
{
"ZKl8OvbZ": {
"properties": {
"q_QdTGFyYC": {
"minimum": 5,
"exclusiveMinimum": true
}
}
}
},
{
"ZKl8OvbZ": {
"properties": {
"q_2_EV7svDeG": {
"maximum": 50,
"exclusiveMaximum": true
}
}
}
}
]
},
{
"anyOf": [
{
"ZKl8OvbZ": {
"properties": {
"q_3_73EoQiGM": {
"const": 200
}
}
}
},
{
"ZKl8OvbZ": {
"properties": {
"q_4_JILfxLjz": {
"const": 100
}
}
}
}
]
}
]
}
]
}
}
}
Hi @chathuraa,
Can you explain what behavior you expect from the posted rule and what behavior you are actually experiencing? Also did you make sure that the schema validation you added to the rule behaves like you expect on its own? You can easily check this with an online validator like this one.
Hey @sdirix ,
I’am using a custom component. and following happens. However when I used material renderer, this issue doesnt happen.
I did some digging around. In the onChange event of the JsonForms the data returns as follows. I cant figure out how the path gets undefined-0-0-0-0. Tested with simple validation, and it does not validates.
{
undefined-0-0-0-0: {
aybrIgiK:{
question_1_9aoC--z8: 1
}
}
}
According to the examples in the website onChange event in JsonForm should look like
{
"aybrIgiK": {
"question_1_9aoC--z8":1
}
}
So I think the form is not evaluating properly…?
Following are the schemas I’m passing
{
"type": "VerticalLayout",
"elements": [
{
"type": "Group",
"label": "",
"elements": [
{
"type": "HorizontalLayout",
"elements": [
{
"type": "VerticalLayout",
"elements": [
{
"type": "Control",
"scope": "#/properties/aybrIgiK/properties/question_1_9aoC--z8",
"label": "Question1",
"options": {
"ui_widget": "inputNumber",
"ui_widget_options": {},
"ui_library": "antd"
}
}
]
}
]
}
]
}
]
}
{
"type": "object",
"properties": {
"aybrIgiK": {
"type": "object",
"properties": {
"question_1_9aoC--z8": {
"type": "number",
"description": "Question1"
}
}
}
}
}
In addition to the above, I’ve tried the schema rule in https://jsonforms-editor.netlify.app/. It doesnt work there either. ![]()
Hi @chathuraa,
Something is definitely wrong with this data, I never saw this before. However when I try the posted schema and uischema then I can’t reproduce the issue. The data I’m receiving is the correct
{
"aybrIgiK": {
"question_1_9aoC--z8": 898989
}
}
Hi @sdirix,
Thanks for your response. I manage to find the issue.
Issue 1:
There was an error in the Layout component (Group/Horizontal/Vertical) passing the path.
Issue 2:
properties property was missing in the rule. Currenetly
"allOf": [
{
"ZKl8OvbZ": {
"properties": {
"q_QdTGFyYC": {
"minimum": 5,
"exclusiveMinimum": true
}
}
}
},
]
Should be:
"allOf": [
{
properties: {
"ZKl8OvbZ": {
"properties": {
"q_QdTGFyYC": {
"minimum": 5,
"exclusiveMinimum": true
}
}
}
}
},
]
After the two fixes the rules are working as expected. Will close this.
Thanks @sdirix .