Skip to end of banner
Go to start of banner

comalaSetState

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Syntax

comalaSetState(pageID, workflowState, comment?)

Description

Sets the workflow state of the page using the Comala Workflows add-on.

Parameters

Parameter name

Type

Required

Description

json

string

Yes

The JSON to be converted.

Return type

variable return type - depending on the left hand side operator type

Examples

Both examples show how JSON data can be parsed into an array or struct collections. Both examples use the following struct definitions:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

struct code {
    number [] rgba;
    string hex;
}
 
struct color {
    string color;
    string category;
    string type;
    code code;
}
 
struct colors {
    color [] colors;
}

Example 1 - Reading JSON from a file

16
17
18
19
20
21
22

string json = readFromTextFile("C:\\colors.json");
 
 
colors cData;
cData = fromJson(json);
 
return cData.colors[0].color;

Example 2 - Reading JSON from a variable

16
17
18
19
20
21

string json = "{\"colors\":[{\"color\":\"red\",\"category\":\"hue\",\"type\":\"primary\",\"code\":{\"rgba\":[255,0,0,1],\"hex\":\"#FF0\"}}]}";
 
colors cData;
cData = fromJson(json);
 
return cData.colors[0].color;


See also



  • No labels