Jump to content
  • 0

Is it possible to query a View in a Calculated Field?


JayDub

Question

I have a DataForm with a calculated field. In the calculated field, I would like to look up and Sum matching records in a View. I know that you can query a Table in a calculated field, and I have done this successfully. However, the value that I need is currently in a View. When I create the query in the calculated field using the name of a View, I get an Invalid Formula error. I am trying to use a View instead of a table because there is not a direct relationship between the current table the DataForm is based on and the Table the value I need to Sum is in. I have to relate both tables via a third 'join' table to get it

If, in fact, you can't query a  View in a calculated field, is it possible to create a query in a Calculated field that joins multiple tables together (I'm guessing no - all of the examples of queries in calculated fields I've seen are simple SELECTs on one table.) Thanks for all input!

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Hi @JayDub,

If you want to select data from a View, you should add prefix _v_ to the View name. More details can be found here: https://howto.caspio.com/datapages/reports/advanced-reporting/calculations-in-forms-and-reports/

You can join as many tables in the Select statement in the Calculated field as needed. The syntax is the same as in the SQL. However, it will be easier to refer to the View.

Link to comment
Share on other sites

  • 0

I tried it and no such luck. My view name is vwAgentProperty

SELECT tblAgent.AgentFullName
FROM prefix_v_vwAgentProperty
WHERE tblAgent.PropertyID=[@field:PropertyID]

 

ALSO TRIED

SELECT tblAgent.AgentFullName
FROM _v_vwAgentProperty
WHERE tblAgent.PropertyID=[@field:PropertyID]

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...