How can I configure Answers for the Questions in FME?
I believe I need to do that in the Additional Parameters Section but I cant figure out how to set it up. Can someone help please?
Hi @serg42932 you're on the right track with the Additional Parameters! This is the parameter you will want to use to fulfill these Questions and Answers for your Inspections.
To start off, here's an example of what your your Additional Parameters may look like:
{"Questions" : m { "QuestionID" : 6439, "Explanation" : null, "Instruction" : null }, { "QuestionID" : 6440, "Explanation" : null, "Instruction" : null } ], "Answers" : 0 { "QuestionID" : 6439, "AnswerId" : "6828", "AnswerValue" : "Not Operating Properly", "InspectionId" : 18658 }, { "QuestionID" : 6440, "AnswerId" : "6829", "AnswerValue" : "Poor Performance", "InspectionId" : 18658 } ] }
Each question and answer have a corresponding ID. If you're not sure what your QuestionIDs and AnswerIds are, you can use the following Cityworks REST API to get this information
https://<your-cityworks-instance>/services/Ams/InspectionTemplate/QA?data={
"InspTemplateIds": i6023]
}
You can use this REST API call in a HTTPCaller. Just make sure to change the Cityworks instance URL and the Inspection Template Id value. Also, you will want to make sure you are using your Cityworks Web Connection as authentication in the HTTPCaller.
I've attached a workspace to this response to help demonstrate how to perform these two steps. Let me know if you have any questions!
Hi @serg42932 you're on the right track with the Additional Parameters! This is the parameter you will want to use to fulfill these Questions and Answers for your Inspections.
To start off, here's an example of what your your Additional Parameters may look like:
{"Questions" : m { "QuestionID" : 6439, "Explanation" : null, "Instruction" : null }, { "QuestionID" : 6440, "Explanation" : null, "Instruction" : null } ], "Answers" : 0 { "QuestionID" : 6439, "AnswerId" : "6828", "AnswerValue" : "Not Operating Properly", "InspectionId" : 18658 }, { "QuestionID" : 6440, "AnswerId" : "6829", "AnswerValue" : "Poor Performance", "InspectionId" : 18658 } ] }
Each question and answer have a corresponding ID. If you're not sure what your QuestionIDs and AnswerIds are, you can use the following Cityworks REST API to get this information
https://<your-cityworks-instance>/services/Ams/InspectionTemplate/QA?data={
"InspTemplateIds": i6023]
}
You can use this REST API call in a HTTPCaller. Just make sure to change the Cityworks instance URL and the Inspection Template Id value. Also, you will want to make sure you are using your Cityworks Web Connection as authentication in the HTTPCaller.
I've attached a workspace to this response to help demonstrate how to perform these two steps. Let me know if you have any questions!
Thank you very much. I will definitely try the way you suggested- I was trying multiple ways to add additional parameters but could not figure out the correct way. I end up applying parameters by using HTTPCaller for Inspection update API. It did work, but I was adding an additional step.
I have another question related to the same workflow:
What Transformer can I use to upload an image related to every Inspection?
In PowerShell, I end up building the following code:
How can I do the same in FME?
Thank you.
Thank you very much. I will definitely try the way you suggested- I was trying multiple ways to add additional parameters but could not figure out the correct way. I end up applying parameters by using HTTPCaller for Inspection update API. It did work, but I was adding an additional step.
I have another question related to the same workflow:
What Transformer can I use to upload an image related to every Inspection?
In PowerShell, I end up building the following code:
How can I do the same in FME?
Thank you.
@serg42932 The HTTPCaller and the Inspection Update API is another great way to add additional information to your Inspections. It does take one additional step, but you get the same end result.
For adding attachments to your Inspections, you can use the AddInspectionAttachment REST API. Since there are some additional parameters to configure, I have attached a workspace to this comment that has the parameters for the API already set in the HTTPCaller. You'll need to make sure you use your own Cityworks instance URL in the HTTPCaller. You will also need to change the InspectionId to match your inspection and set the file path of the parameter and use your own Cityworks web connection.
Thank you very much. I will definitely try the way you suggested- I was trying multiple ways to add additional parameters but could not figure out the correct way. I end up applying parameters by using HTTPCaller for Inspection update API. It did work, but I was adding an additional step.
I have another question related to the same workflow:
What Transformer can I use to upload an image related to every Inspection?
In PowerShell, I end up building the following code:
How can I do the same in FME?
Thank you.
Hi Dan, I have another question. So, I have a URL for each image that must be attached to every Inspection. How I can download the image and post it as an Inspection attachment? Or, there might be a tool that can do both steps.
Thank you.
Thank you very much. I will definitely try the way you suggested- I was trying multiple ways to add additional parameters but could not figure out the correct way. I end up applying parameters by using HTTPCaller for Inspection update API. It did work, but I was adding an additional step.
I have another question related to the same workflow:
What Transformer can I use to upload an image related to every Inspection?
In PowerShell, I end up building the following code:
How can I do the same in FME?
Thank you.
@serg42932 with a URL for each image, you can read the images using the ImageFetcher. You will then need to save these files locally with a JPEG/PNG Writer (or FeatureWriter) before you can attach them to your inspections. To attach the image to your inspection, you can follow the steps and the workspace in my previous comment above.
Thank you very much. I will definitely try the way you suggested- I was trying multiple ways to add additional parameters but could not figure out the correct way. I end up applying parameters by using HTTPCaller for Inspection update API. It did work, but I was adding an additional step.
I have another question related to the same workflow:
What Transformer can I use to upload an image related to every Inspection?
In PowerShell, I end up building the following code:
How can I do the same in FME?
Thank you.
@danminneyatsafe Thank you very much for your help.
I am still having trouble combining creating the Inspections with adding the attachments. However, I managed to run both processes separately- I can create a batch of the Inspections from an Excel spreadsheet with entity type and Inspection Template ID fields, and I can attach a single saved image file to Inspection, which I specified with Inspection ID. I had no luck with having an Excel spreadsheet (let's say with five rows, where each row will be data for different Inspection. One column has a url_link to the image), so I can create Inspections and add images to them accordingly based on url_link image ID. Must the ImageFetcher and FeatureWriter be in parallel with InspectorCreator, and then both outcomes will go to HTTP Caller, where I can use Cityworks API for AddAttachment? Or should ImageFetcher and FeatureWriter be configured after the InspectorCreator and specific parameters must be set?
Thank you very much. I will definitely try the way you suggested- I was trying multiple ways to add additional parameters but could not figure out the correct way. I end up applying parameters by using HTTPCaller for Inspection update API. It did work, but I was adding an additional step.
I have another question related to the same workflow:
What Transformer can I use to upload an image related to every Inspection?
In PowerShell, I end up building the following code:
How can I do the same in FME?
Thank you.
Hi @serggavrylov, you can run the ImageFetcher and the FeatureWriter after the InspectorCreator. In my opinion, this is the more robust option as it relies on the InspectorCreator having run successfully before the images can be downloaded and attached to the Inspection.
Alternatively, you can run the ImageFetcher and the FeatureWriter in parallel with the Inspector Creator and that will work fine. You will want to make sure that when you use the Cityworks API for AddAttachment, you are adding the attachment after the inspection has been created. You could use a FeatureHolder to control your workspace so that the images are only attached once the InspectorCreator has finished running.
Hi @danminneyatsafe, finally, I was able to successfully create this workflow Took me some time to figure out the parameters set up - but it is working now.
Inspections are created, and then images are attached to them accordingly. The way I have set it up - all images are uploaded to the folder, and then they add to Inspections. Is there a way to create a kind of loop - that will download the image to the folder, attach it to the Inspection, and then the next Inspection creates an image that will overwrite the previous image?
I came across this post while also working on something similar.
Hope that question makes sense.
If you’re using the InspectionCreator, you will need to supply this information in the Additional Request Parameters field.
Hope this helps!
Dan M
Hi