on 2023 Sep 25 7:33 PM
I am implementing a Production Process to log a Data Collection for a DC Group with 2 parameters. This process will be called from Plant Connectivity via an Automatic Trigger.
From the current API documentation the JSON structure for Log_DC api is this:
{
"group": {
"dcGroup": "string",
"version": "string"
},
"operation": {
"operation": "string",
"version": "string"
},
"parameterValues": [
{
"comment": "string",
"files": [
{
"fileContent": "string",
"fileId": "string",
"fileMediaType": "string",
"fileName": "string"
}
],
"name": "string",
"value": "string"
}
],
"plant": "string",
"resource": "string",
"sfcs": [
"string"
],
"stepId": "string",
"workCenter": "string"
}
I am attempting to use a Script Task to construct the DC Group structure and parameterValues array structure like this:
$output.group = {
"dcGroup": $input.dcGroup,
"version": "A"
};
$output.parameterValues = [];
if ($input.weld_te_Pos_val !== null) {
$output.parameterValues.push({
"name": "WELD_TE_POS", "value": $input.weld_te_Pos_val
});
}
if ($input.weld_align_axial_val !== null) {
$output.parameterValues.push({
"name": "WELD_ALIGN_AXIAL", "value": $input.weld_align_axial_val
});
}
When this script is Run it properly creates the structures:
• group: {"dcGroup":"WELDER","version":"A"}
• parameterValues: [{"name":"WELD_TE_POS","value":25},{"name":"WELD_ALIGN_AXIAL","value":35}]
However, when I try to assign the ScriptTask#parameterValues structure to the Log_DC API parameterValues, I get this:
Assign the script output variable:
Then this appears:
I cannot assign anything to any of the Parameter Definitions and cannot Save either.
What am I missing with this design?
Request clarification before answering.
Hi Steve,
You dont need to create the JSON structure if you dont want to, you can map the individual values directly into the input structure. Give me a call and I can show you how.
Thanks
Kevin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you seem to be using the Schema "Schemas>DataCollectionParameter> DataCollectionParameter" which is used for defining data collections and not for filling them.
Kind Regards
Jonas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jonas,
Thanks for the help.
I found that I had referenced the schema DataCollectionParameter for the parameterValues output of the script task, instead of the Parameters schema, as you indicated. The correct Schema is identified in the Request Body LogRequest Schema in the Service Registry, but the heading for the Schema Definition column is Data Type; Data Type/Schema would be more clear. It would also be more helpful to be able to search by Group Name in the Script Task Schema Selection.
Regards, Steve
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.