If you are unable to create a new account, please email support@bspsoftware.com

Author Topic: Expression Trouble-Shooting  (Read 5731 times)

Offline zesty1989

  • Full Member
  • ***
  • Join Date: Aug 2018
  • Posts: 7
  • Forum Citizenship: +0/-0
Expression Trouble-Shooting
« on: 22 Jan 2020 01:04:26 pm »
All,
I am writing a report based in eCW's eBO. I have a radio button that allows the user to toggle between two types of providers: the appointment provider and the resource providers. I also have a radio button that allows the user to toggle between two types of reports: a summary report, and a detail report. The reports won't work because I can't seem to get the expressions right. Below is an example of the expression that I originally tried to insert into a data item but I get a 'QE-DEF-0459 CCLException' error that indicates that my parsing is off. Is the methodology or the expression wrong? Or, are they both wrong?

if (?Provider_Toggle? = 'Appointment Provider') then
([EMR Reporting].[Appointment Providers].[Appointment Provider Last Name]) else
if (?Provider_Toggle? = 'Resource Provider') then ([Resource Provider Last Name]) else ('None')

Offline adam_mc

  • Statesman
  • ******
  • Join Date: Mar 2012
  • Posts: 319
  • Forum Citizenship: +15/-0
Re: Expression Trouble-Shooting
« Reply #1 on: 22 Jan 2020 01:19:32 pm »
You at least need parenthesis around your first "else" statement.

Something like:

if (?Provider_Toggle? = 'Appointment Provider')
then ([EMR Reporting].[Appointment Providers].[Appointment Provider Last Name])
else (
        if (?Provider_Toggle? = 'Resource Provider')
        then ([Resource Provider Last Name])
        else ('None')
       )

Hope this helps.
Adam

Offline zesty1989

  • Full Member
  • ***
  • Join Date: Aug 2018
  • Posts: 7
  • Forum Citizenship: +0/-0
Re: Expression Trouble-Shooting
« Reply #2 on: 22 Jan 2020 02:14:32 pm »
You at least need parenthesis around your first "else" statement.

Something like:

if (?Provider_Toggle? = 'Appointment Provider')
then ([EMR Reporting].[Appointment Providers].[Appointment Provider Last Name])
else (
        if (?Provider_Toggle? = 'Resource Provider')
        then ([Resource Provider Last Name])
        else ('None')
       )

Hey, thanks for answering! I just tried to do that, but it didn't work. I still got the same error.

Offline bus_pass_man

  • Statesman
  • ******
  • Join Date: May 2008
  • Posts: 547
  • Forum Citizenship: +48/-0
Re: Expression Trouble-Shooting
« Reply #3 on: 22 Jan 2020 02:53:41 pm »

What happens if the entry is neither appointment provider or resource provider?

 
Quote
then ([Resource Provider Last Name])
Are you sure you want a 1 part name here and not a 3 part name?

Have you thought about making the expression a case ?

Create an expression with just the nested bit and see if that works.  That would reduce the problem space.

What is the exact wording of the error?

Offline BigChris

  • Statesman
  • ******
  • Join Date: Apr 2013
  • Posts: 1,270
  • Forum Citizenship: +91/-0
Re: Expression Trouble-Shooting
« Reply #4 on: 23 Jan 2020 02:49:07 am »
Because I manage to lose track of brackets, I generally prefer case statements if things get elongated:

Code: [Select]
case
  when ?Provider_Toggle? = 'Appointment Provider' then [EMR Reporting].[Appointment Providers].[Appointment Provider Last Name]
  when ?Provider_Toggle? = 'Resource Provider' then [Resource Provider Last Name]
  else 'None'
end

Also, is this of any use? https://www.cognoise.com/index.php?topic=28925.0

Offline zesty1989

  • Full Member
  • ***
  • Join Date: Aug 2018
  • Posts: 7
  • Forum Citizenship: +0/-0
Re: Expression Trouble-Shooting
« Reply #5 on: 23 Jan 2020 10:20:48 am »
I just tried that and I still get the same error. Is it the methodology? I'm trying to put it into a data item. Should I be writing it as a filter, or expression elsewhere?

Offline zesty1989

  • Full Member
  • ***
  • Join Date: Aug 2018
  • Posts: 7
  • Forum Citizenship: +0/-0
Re: Expression Trouble-Shooting
« Reply #6 on: 23 Jan 2020 10:26:25 am »
Also, is this of any use? https://www.cognoise.com/index.php?topic=28925.0

That may be of assistance. I tried to copy the pattern you created. Here is the code I wrote:
Code: [Select]
IF( (?Provider_Toggle? = 'Appointment Provider')
THEN ([EMR Reporting].[Appointment Providers].[Appointment Provider Last Name])
ELSE ([Resource Provider Last Name])