1. Jay Madren
  2. Valentina Reports ADK
  3. Sunday, December 31 2017, 04:06 PM
  4.  Subscribe via email
I am trying to pass boolean values to a report from Xojo. Using/passing only string values works fine.

I have defined some parameters as boolean. Because of issues trying to use the parameter directly in a print_if conditional (see below), I included the parameter in the query. But since the function SetParameterValue only takes string values, I have to pass string values of "true" or "false", which then generates this valentina exception:

Datasource error: "ERROR: failed to find conversion function from unknown to boolean".

On the print_if conditional issue, I was trying to do as discussed here, but no matter what types and values I use, I can't get it to work. It always gives the following error in preview within studio:

Page 1: ERROR: syntax error at or near "$"

Seems like print_if can't use parameters.
Comment
There are no comments made yet.
Sergey Pashkov Accepted Answer
Hello Jay,

That's how I did it:

1. Created boolean parameter pPrintCircle in the query dialog
2. Inserted parameter into the query with an alias: $P(pPrintCircle) AS printCircle. Now printCircle acts as an ordinary boolean field
3. Set print_if property value to the alias name: printCircle

Right, SetParameterValue accepts string so you pass "true" or "false" in the Xojo code.

But maybe you have a more complex case? Please describe what element do you want to hide, in what region.
Attachments (3)
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 1
Jay Madren Accepted Answer
Yes, that's how I set it up. But then setting the parameter from Xojo results in the Valentina exception I listed earlier.

I finally got it working by making the select statement force the parameter to be a boolean, like so:

Select..., case when $P(IncludeSummary)='True' then true else false end as IncSum

Without this, it seems that either Valentina or the db can't figure out how to convert the passed string parameter to a boolean.
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 2
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Categories

Announcements & News
  1. 0 subcategories
Valentina Studio
  1. 2 subcategories
Valentina Server
  1. 4 subcategories
Valentina Database ADK
  1. 0 subcategories
Valentina Reports ADK
  1. 0 subcategories
Other Discussions
  1. 0 subcategories
BETA Testing
  1. 0 subcategories
Education & Research
  1. 0 subcategories
Omegabundle
  1. 0 subcategories