Skip to main content
Solved

when to use single quotes in Project Variables

  • November 19, 2019
  • 1 reply
  • 29 views

what is the right scenario for using single quotes to wrap project variables? 

 

Let's say i have a data constraint added to a field and i am using a dynamic project variable like, so

in this scenario, i am comparing a data to another date, and i have the variable encased in single quotes.

I always assumed the single quotes was how Discovery Hub "renders" the underlying variable, but i recently found that my assumption was untrue. 

is the single quotes only to be used when evaluating a character string? or are there some rules to apply wrapping in single quotes.

 

Note: the variable above is a dynamic -> select max({datefield}) from {table} statement, under the covers. 

Best answer by JTreadwell

Hi Josiah, Thanks for posting. 

Discovery Hub will always render a variable. You only need single quotes when evaluating character strings. So in the above example you need single quotes because SQL will be evaluating the date string that will be rendered from the variable. 

You can click the "Show Translation" radio button at the bottom of the dialog box to see what script will be passed to SQL. 

A rule of thumb for custom Data Selection Rules: Just type your WHERE clause, but without the "WHERE". So after you click "show translation" this will be what's passed to SQL as the WHERE clause. 

Hope that helps. 

View original
Did this topic help you find an answer to your question?

JTreadwell
Employee
Forum|alt.badge.img+5

Hi Josiah, Thanks for posting. 

Discovery Hub will always render a variable. You only need single quotes when evaluating character strings. So in the above example you need single quotes because SQL will be evaluating the date string that will be rendered from the variable. 

You can click the "Show Translation" radio button at the bottom of the dialog box to see what script will be passed to SQL. 

A rule of thumb for custom Data Selection Rules: Just type your WHERE clause, but without the "WHERE". So after you click "show translation" this will be what's passed to SQL as the WHERE clause. 

Hope that helps. 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings