1

evaulate Query field value before rendering Canvas URL Widget

It seems that Query field values cannot be used in URL Widgets on Canvas pages with the typical {squiggly-brackets} syntax.  Presumably the value of the Query field is being calculated *after* the URL Widget has been rendered.

I'm attempting to use the Google Charts URL API to make some simple pie and bar charts.  I can construct functional Charts URLs using real baked values on entities e.g. {frame_count} from a Version, but the value of {any_query_field_returning_a_number} is getting passed as 'null' into the Chart URL.

I've got the context of an entity by virtue of the fact that I've created the Canvas page as the default (first) tab for an entity's Detail page.  For example you could create a Canvas page as the default tab for the Version Detail page, then add a URL Widget to that tab, and use this URL:

https://chart.googleapis.com/chart?cht=p&chs=300x300&chdl=Baked|Query&chds=a&chd=t:{frame_count},{sg_frames_actual_query}

where sg_frames_actual_query would be a user-created Query field on the Version entity that summarizes something.  The pie chart renders as 100% full of just the Frame Count.  But change the query field to some other baked value, et voila.

It would be great if the URL-Widget-Render / Query-field-eval order of operations could be switched.  Sadly, the alternatives are:

- a daemon or some other automated process to run the Queries via the API then bake the values into some other static field on the entity, defeating the point of creating a Query field, or

- write a separate page that runs the Queries via the API, baking them into the Chart URLs and passing them on up to Google then rendering the results, using that internal separate page as the URL for the URL Widget, defeating the simplicity and utility of the URL Widget to do that itself directly

3 comments

  • 0
    Avatar
    Tony Aiello

    Likely related to https://support.shotgunsoftware.com/hc/en-us/community/posts/209480108 , but I think (hope!) this request might be easier to implement since it doesn't require the ability for a user to re-interact with the calculated query results after rendering.

  • 0
    Avatar
    Tony Aiello

    Hey there!  Revisiting this with v7.11's query-fields-available-thru-API feature.  Since query fields will become calculated server-side, I'm guessing maybe this feature request would also become "fixed"?  Any chance someone might add a check or QA test for that as part of the new feature?

  • 0
    Avatar
    Brandon Foster

    Hey Tony,

    There's actually some significant query field optimizations in the works which may render the need to do any order-of-operations changes for page loading unnecessary. No dates to announce yet, but the work is in progress.

Please sign in to leave a comment.