Select to view content in your preferred language

WAB: How do I customize output messages in GP Widget Output tab?

5575
18
Jump to solution
08-30-2017 07:52 AM
FrancescoTonini2
Frequent Contributor

Can anyone help me understand what file(s) and code chunks I need to look at to customize the info, warning, or error messages that get sent to the Output tab of the GP Widget in WAB? Related to this, what should I do if I wanted to output my own custom messages into an on-screen message window that opens only after GP widget is done executing? Thanks!

18 Replies
AhnaMiller2
Frequent Contributor

Sure thing, do you have an email I can send to directly?

0 Kudos
ErnestoCarreras4
Occasional Contributor

ahnamiller

I am interested in this solution since I am trying to do the same. Is there any way you can share the workaround solution?

Regards,

EC

0 Kudos
AhnaMiller2
Frequent Contributor

Hi Ernestocd

I achieved this by creating a python script from desktop and publishing as a Geoprocessing service that can then be served up in the geoprocessing widget.  Your script should contain an output that has an arcpy.AddMessage() and arcpy.SetParameterAsText() . The set parameter as text will be the thing that passes information as an output. 
Here's a small snippet of what this looks like: 

Snippet of Code

In the properties of the script tool,  set your parameter properties to be Type: Derived & Direction: Output (this makes sure the message you put in for SetParameterAsText() is an output)
Properties Dialogue box
Additionally, when you are publishing your service on the Parameters tab of the Service Editor box, set the message level to Info
ServiceEditor
Hope this helps! Feel free to reach out if you get stuck

ErnestoCarreras4
Occasional Contributor

Worked like a charm! Thanks

MarcelBuford1
New Contributor

@Ahna Miller, this is an excellent technique; I've been attempting to accomplish this for more than a week, thanks! One question: although my messages print to the Output tab, they only appear after the GP widget is finished executing. Is this your experience? Ideally, I would like my users to see messages while the process is running, especially during long-running scripts. Is there a way to output messages while the process is running? Thanks again

0 Kudos
AhnaMiller2
Frequent Contributor

So glad it worked well for you!

What you describe has been my experience as well, unfortunately. If you, or anyone here has found how to do it, I'd appreciate the advice- maybe the key lies in synchronous or asynchronous publishing of the service? 

by Anonymous User
Not applicable

Hey Robert -- just confirming before I edit one of the annoyingly detailed GP services that everything else is in order

Once the geoprocessing/widget.js is updated to pull in the appropriate message types:

and once the job is configured to report 'Info' level messages (and the script is doing so):

and the python script sets an output parameter of the output message, then the geoprocessing widget should show all messages after the geoprocessing task is complete.

Am I missing anything, to your knowledge?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Not that I know of.

by Anonymous User
Not applicable

Awesome, i'll give it a go and report back to the team  

0 Kudos