convert this to below format // Named Range - Text Equals { "conditionCode":…
- User
convert this to below format
// Named Range - Text Equals { "conditionCode": "cell_value", "operator": "equal", "payload": { "targetType": "named_range", "dataType": "text", "operator": "equals", "targetLocation": "xInput_Name", "targetValue": "John Doe" } }
// Named Range - Text Contains { "conditionCode": "cell_value", "operator": "equal", "payload": { "targetType": "named_range", "dataType": "text", "operator": "contains", "targetLocation": "xInput_Description", "targetValue": "Project" } }
// Named Range - Text Starts With { "conditionCode": "cell_value", "operator": "equal", "payload": { "targetType": "named_range", "dataType": "text", "operator": "starts_with", "targetLocation": "xInput_Code", "targetValue": "PRJ" } }
// Named Range - Text Ends With { "conditionCode": "cell_value", "operator": "equal", "payload": { "targetType": "named_range", "dataType": "text", "operator": "ends_with", "targetLocation": "xInput_Email", "targetValue": "@company.com" } }
// Cell Address - Text Equals { "conditionCode": "cell_value", "operator": "equal", "payload": { "targetType": "cell_address", "dataType": "text", "operator": "equals", "targetLocation": "Sheet1!A1", "targetValue": "Status" } }// Named Range - Number Equals { "conditionCode": "cell_value", "operator": "equal", "payload": { "targetType": "named_range", "dataType": "number", "operator": "equals", "targetLocation": "xInput_Amount", "targetValue": "1000" } }
// Named Range - Number Greater Than { "conditionCode": "cell_value", "operator": "equal", "payload": { "targetType": "named_range", "dataType": "number", "operator": "greater_than", "targetLocation": "xInput_Quantity", "targetValue": "50" } }
// Named Range - Number Less Than { "conditionCode": "cell_value", "operator": "equal", "payload": { "targetType": "named_range", "dataType": "number", "operator": "less_than", "targetLocation": "xInput_Balance", "targetValue": "100" } }
// Named Range - Number Greater Equal { "conditionCode": "cell_value", "operator": "equal", "payload": { "targetType": "named_range", "dataType": "number", "operator": "greater_equal", "targetLocation": "xInput_Score", "targetValue": "75" } }
// Named Range - Number Less Equal { "conditionCode": "cell_value", "operator": "equal", "payload": { "targetType": "named_range", "dataType": "number", "operator": "less_equal", "targetLocation": "xInput_Discount", "targetValue": "20" } }// Named Range - Boolean Equals { "conditionCode": "cell_value", "operator": "equal", "payload": { "targetType": "named_range", "dataType": "boolean", "operator": "equals", "targetLocation": "xInput_IsActive", "targetValue": "true" } }
// Cell Address - Boolean Equals { "conditionCode": "cell_value", "operator": "equal", "payload": { "targetType": "cell_address", "dataType": "boolean", "operator": "equals", "targetLocation": "Sheet1!B1", "targetValue": "false" } }// Named Range - Date Equals { "conditionCode": "cell_value", "operator": "equal", "payload": { "targetType": "named_range", "dataType": "date", "operator": "equals", "targetLocation": "xInput_StartDate", "targetValue": "2024-03-20" } }
// Named Range - Date Before { "conditionCode": "cell_value", "operator": "equal", "payload": { "targetType": "named_range", "dataType": "date", "operator": "before", "targetLocation": "xInput_EndDate", "targetValue": "2024-12-31" } }
// Named Range - Date After { "conditionCode": "cell_value", "operator": "equal", "payload": { "targetType": "named_range", "dataType": "date", "operator": "after", "targetLocation": "xInput_ReviewDate", "targetValue": "2024-01-01" } }
// Cell Address - Date Equals { "conditionCode": "cell_value", "operator": "equal", "payload": { "targetType": "cell_address", "dataType": "date", "operator": "equals", "targetLocation": "Sheet1!C1", "targetValue": "2024-03-20" } }
in below json format
"task_conditions": [ { "object": "task_condition", "id": "{{PV_TASK_CONDITION_ID_1}}", "data": { "target_task_id": null, "target_id": null, "target_description": "User is a Group Member", "sequence": 1, "condition_code": "role", "operator": "in_list", "error_message": "", "payload": { "role": "{{PV_MAKER_ROLES}}", "operator": "", "target_name": "User is a Group Member" }, "operator_overridable": false } }, { "object": "task_condition", "id": "{{PV_TASK_CONDITION_ID_2}}", "data": { "target_task_id": null, "target_id": null, "target_description": "User is a allowed", "sequence": 2, "condition_code": "user", "error_message": "", "operator": "in_list", "payload": { "usernames": "{{PV_MAKER_USERS}}", "operator": "", "target_name": "User is allowed" }, "operator_overridable": false } } ]
ChatGPT
- Assistant
Certainly! Below is the converted JSON format to match your specified structure for the various conditions you provided earlier.
{ "task_conditions": [ { "object": "task_condition", "id": "task_condition_1", "data": { "target_task_id": null, "target_id": null, "target_description": "Named Range - Text Equals", "sequence": 1, "condition_code": "cell_value", "operator": "equal", "error_message": "", "payload": { "targetType": "named_range", "dataType": "text", "operator": "equals", "targetLocation": "xInput_Name", "targetValue": "John Doe" }, "operator_overridable": false } }, { "object": "task_condition", "id": "task_condition_2", "data": { "target_task_id": null, "target_id": null, "target_description": "Named Range - Text Contains", "sequence": 2, "condition_code": "cell_value", "operator": "equal", "error_message": "", "payload": { "targetType": "named_range", "dataType": "text", "operator": "contains", "targetLocation": "xInput_Description", "targetValue": "Project" }, "operator_overridable": false } }, { "object": "task_condition", "id": "task_condition_3", "data": { "target_task_id": null, "target_id": null, "target_description": "Named Range - Text Starts With", "sequence": 3, "condition_code": "cell_value", "operator": "equal", "error_message": "", "payload": { "targetType": "named_range", "dataType": "text", "operator": "starts_with", "targetLocation": "xInput_Code", "targetValue": "PRJ" }, "operator_overridable": false } }, { "object": "task_condition", "id": "task_condition_4", "data": { "target_task_id": null, "target_id": null, "target_description": "Named Range - Text Ends With", "sequence": 4, "condition_code": "cell_value", "operator": "equal", "error_message": "", "payload": { "targetType": "named_range", "dataType": "text", "operator": "ends_with", "targetLocation": "xInput_Email", "targetValue": "@company.com" }, "operator_overridable": false } }, { "object": "task_condition", "id": "task_condition_5", "data": { "target_task_id": null, "target_id": null, "target_description": "Cell Address - Text Equals", "sequence": 5, "condition_code": "cell_value", "operator": "equal", "error_message": "", "payload": { "targetType": "cell_address", "dataType": "text", "operator": "equals", "targetLocation": "Sheet1!A1", "targetValue": "Status" }, "operator_overridable": false } }, { "object": "task_condition", "id": "task_condition_6", "data": { "target_task_id": null, "target_id": null, "target_description": "Named Range - Number Equals", "sequence": 6, "condition_code": "cell_value", "operator": "equal", "error_message": "", "payload": { "targetType": "named_range", "dataType": "number", "operator": "equals", "targetLocation": "xInput_Amount", "targetValue": "1000" }, "operator_overridable": false } }, { "object": "task_condition", "id": "task_condition_7", "data": { "target_task_id": null, "target_id": null, "target_description": "Named Range - Number Greater Than", "sequence": 7, "condition_code": "cell_value", "operator": "equal", "error_message": "", "payload": { "targetType": "named_range", "dataType": "number", "operator": "greater_than", "targetLocation": "xInput_Quantity", "targetValue": "50" }, "operator_overridable": false } }, { "object": "task_condition", "id": "task_condition_8", "data": { "target_task_id": null, "target_id": null, "target_description": "Named Range - Number Less Than", "sequence": 8, "condition_code": "cell_value", "operator": "equal", "error_message": "", "payload": { "targetType": "named_range", "dataType": "number", "operator": "less_than", "targetLocation": "xInput_Balance", "targetValue": "100" }, "operator_overridable": false } }, { "object": "task_condition", "id": "task_condition_9", "data": { "target_task_id": null, "target_id": null, "target_description": "Named Range - Number Greater Equal", "sequence": 9, "condition_code": "cell_value", "operator": "equal", "error_message": "", "payload": { "targetType": "named_range", "dataType": "number", "operator": "greater_equal", "targetLocation": "xInput_Score", "targetValue": "75" }, "operator_overridable": false } }, { "object": "task_condition", "id": "task_condition_10", "data": { "target_task_id": null, "target_id": null, "target_description": "Named Range - Number Less Equal", "sequence": 10, "condition_code": "cell_value", "operator": "equal", "error_message": "", "payload": { "targetType": "named_range", "dataType": "number", "operator": "less_equal", "targetLocation": "xInput_Discount", "targetValue": "20" }, "operator_overridable": false } }, { "object": "task_condition", "id": "task_condition_11", "data": { "target_task_id": null, "target_id": null, "target_description": "Named Range - Boolean Equals", "sequence": 11, "condition_code": "cell_value", "operator": "equal", "error_message": "", "payload": { "targetType": "named_range", "dataType": "boolean", "operator": "equals", "targetLocation": "xInput_IsActive", "targetValue": "true" }, "operator_overridable": false } }, { "object": "task_condition", "id": "task_condition_12", "data": { "target_task_id": null, "target_id": null, "target_description": "Cell Address - Boolean Equals", "sequence": 12, "condition_code": "cell_value", "operator": "equal", "error_message": "", "payload": { "targetType": "cell_address", "dataType": "boolean", "operator": "equals", "targetLocation": "Sheet1!B1", "targetValue": "false" }, "operator_overridable": false } }, { "object": "task_condition", "id": "task_condition_13", "data": { "target_task_id": null, "target_id": null, "target_description": "Named Range - Date Equals", "sequence": 13, "condition_code": "cell_value", "operator": "equal", "error_message": "", "payload": { "targetType": "named_range", "dataType": "date", "operator": "equals", "targetLocation": "xInput_StartDate", "targetValue": "2024-03-20" }, "operator_overridable": false } }, { "object": "task_condition", "id": "task_condition_14", "data": { "target_task_id": null, "target_id": null, "target_description": "Named Range - Date Before", "sequence": 14, "condition_code": "cell_value", "operator": "equal", "error_message": "", "payload": { "targetType": "named_range", "dataType": "date", "operator": "before", "targetLocation": "xInput_EndDate", "targetValue": "2024-12-31" }, "operator_overridable": false } }, { "object": "task_condition", "id": "task_condition_15", "data": { "target_task_id": null, "target_id": null, "target_description": "Named Range - Date After", "sequence": 15, "condition_code": "cell_value", "operator": "equal", "error_message": "", "payload": { "targetType": "named_range", "dataType": "date", "operator": "after", "targetLocation": "xInput_ReviewDate", "targetValue": "2024-01-01" }, "operator_overridable": false } }, { "object": "task_condition", "id": "task_condition_16", "data": { "target_task_id": null, "target_id": null, "target_description": "Cell Address - Date Equals", "sequence": 16, "condition_code": "cell_value", "operator": "equal", "error_message": "", "payload": { "targetType": "cell_address", "dataType": "date", "operator": "equals", "targetLocation": "Sheet1!C1", "targetValue": "2024-03-20" }, "operator_overridable": false } } ] }This JSON array captures each of the conditions as specified in your original examples while adhering to the desired structure you've outlined. Each condition has its own unique ID and descriptive field for clarity. Adjust the IDs as necessary to fit your application's requirements.