I need to create an automation that will calculate 3 condition scores based on a series of questions answered via S123 submissions. What transformers would be best to use to calculate the condition scores? I’ve tried using the expressionevaluator, but it seems like the values don’t all get transferred.
I’m also having a difficult time writing the calculated scores back to the feature service, what parameters should be set when writing calculated scores back to the feature service?
Thanks for any help!
Page 1 / 1
Hi @mgaylord thanks for your question! This sounds like an interesting logic problem and I’m intrigued but I don’t believe I have enough information to provide any answers.
Calculating values really depends on the input data types.
Is your data numbers, strings, all of the above? ExpressionEvaluator is one option, or you could use an AttributeManager / AttributeCreator for conditional values as well.
I’m not sure what you mean by “values don’t all get transferred”, where are you expecting to see the values? How are they being transferred? How is your ExpressionEvaluator set up currently?
Perhaps you could share your workspace?
For writing back to the feature service, you don’t mention what the error is. This could be a number of issues including mismatched data types, or maybe you’re having trouble writing to a column that doesn’t exist yet. I believe we would need more info on this section as well such as:
Could you provide your log file with the errors you are facing?
What writer are you using?
What version of FME do you have?
Could you provide screenshots of your writer configuration,
Or, please share your workspace
Let us know!
Hi Evie,
Thanks for writing back! I’ve been able to use the expression evaluator to calculate my needed values. I confirmed this works on a one off basis with specified records using the objectid field. I have confidence my workspace is running appropriately, but now I’m having trouble with getting the automation running on FME Flow Hosted. I’m thinking this may have something to do with the webhook and JSON.
My current workspace does not have any json readers or transformers. Below is the flow of the workspace:
Portal Feature Service Reader > ExpressionEvalualtor Transformer > ExpressionEvalualtor Transformer > ExpressionEvalualtor Transformer > *the workflow spits here* > Write back to the Portal Feature service
The other branch after the last ExpressionEvaluator goes > AttributeKeeper Transformer > SQL database writer.
The whole goal is to have the hosted feature layer updated with the calculated scores from the associated S123 form, and to also have just the condition score sent to a SQL database.
In FME Flow Hosted, I created an automation that uses a webhook trigger. I then enabled/ set the webhook in the associated S123 form. After the trigger, I set the action to Run Workspace, but I get the following error below after I submit a survey to test the automation:
I’m not sure if it’s the JSON that is causing the error, and if it is, I’m not quite sure what I need to do to get the workspace to understand the JSON.
I have a where clause on the Portal Feature Service reader to only read the submitted record at a time:
objectid=@Value(objectid)
Hi @mgaylord thanks for your response and more information! I believe you will need to have something to read in the JSON and parse it, at least to get that objectid. We have a great tutorial on setting up this workflow with Survey123 and webhooks. I would download the workspace attached and borrow from that example.
For testing on FME Form, I would download an example JSON snippet that you expect from the webhook and input it to see if it performs as you expect. You can generate your own JSON from this step in the article.
Hopefully this helps you get up and running, let me know if you have additional questions!