Jump to content
  • 0

Prefix for views used in calculations: 'v_MyView' or 'vMyView'?


KG360

Question

The Caspio 'howto' say I should add the prefix '_v_' before the view title. I have used 'v_MyView', 'vMyView', but am still unsure of which the correct prefix. The '_v_' is a bit ambiguous to me. Or, does it not matter if there is a 'v' as the first character? Can anyone give me a hint please?

G

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Hello @Gunnar360c,

I hope that I got your question correctly. 

You may name your Views as you like. 

But when you need to select values from a View and write a query, then always refer to the View as _v_YourViewName.

You may find this information in this article https://howto.caspio.com/datapages/reports/advanced-reporting/calculations-in-forms-and-reports/

oFNu7kW.png

 

For example: The View name is Customers.

SELECT Description FROM _v_Customers WHERE CustomerID=target.[@field:CustomerID]

If it is not the case, please reply in this thread so we can discuss it further. 

Link to comment
Share on other sites

  • 0
34 minutes ago, CoopperBackpack said:

Hello @Gunnar360c,

I hope that I got your question correctly. 

You may name your Views as you like. 

But when you need to select values from a View and write a query, then always refer to the View as _v_YourViewName.

You may find this information in this article https://howto.caspio.com/datapages/reports/advanced-reporting/calculations-in-forms-and-reports/

oFNu7kW.png

 

For example: The View name is Customers.

SELECT Description FROM _v_Customers WHERE CustomerID=target.[@field:CustomerID]

If it is not the case, please reply in this thread so we can discuss it further. 

Many thanks @CoopperBackpack – very enlightening! I honestly thought I would need to name the view with that prefix :) Now it's clear though, and I will rename my views back (without the prefix) and may become more successful ussing views in my calculations. It was the text 'add prefix_v_ to the View name' that got me on the wrong course here ... I will get cracking trying it out right away!

Many thanks again!

Link to comment
Share on other sites

  • 0

@Gunnar360c,

I am glad if my explanation made it clearer. 

Please note that if you rename Tables/Views/Field Names you need to rename them in the formulas manually

 

Let`s say I use the same statement in Calculated Field: 

SELECT Description FROM _v_Customers WHERE CustomerID=target.[@field:CustomerID]

Then I decided to rename the View name (Customers -> Customers_View) and the Field Name (Description -> Overview).

My next step is to go to the DataPage -> Calculated Field -> change the statement

SELECT Overview FROM _v_Customers_View WHERE CustomerID=target.[@field:CustomerID]
Link to comment
Share on other sites

  • 0
9 minutes ago, CoopperBackpack said:

@Gunnar360c,

I am glad if my explanation made it clearer. 

Please note that if you rename Tables/Views/Field Names you need to rename them in the formulas manually

 

Let`s say I use the same statement in Calculated Field: 

SELECT Description FROM _v_Customers WHERE CustomerID=target.[@field:CustomerID]

Then I decided to rename the View name (Customers -> Customers_View) and the Field Name (Description -> Overview).

My next step is to go to the DataPage -> Calculated Field -> change the statement

SELECT Overview FROM _v_Customers_View WHERE CustomerID=target.[@field:CustomerID]

@CoopperBackpack – thank you for making sure I got that! I might have to just endure my naming convention for views, they start with vw_MyView (and tables tbl_Something) as a way easily see the nature of the datasource, old habits I suppose. This means that I would need to write _v_vw_MyView in SELECT statements... looks bad but just an inconvenience. Just to add, most of my SELECT statements pick data from tables anyway.Thanks!!! 

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...