Solved

IF statement based on published parameter SQLCreator

  • 6 March 2023
  • 1 reply
  • 0 views

Userlevel 3
Badge +26

In a SQLCreator, I want to return the records from a specific table, if a certain choice is made in a parameter. I have a published parameter "check_choice", that is a Choice Multiple Parameter.  In this example, I want to return table records from BUILT_UP_AREA_S if 'BUA_Road_RTY' is selected in the parameter. The database type is Microsoft SQL Server Non-Spatial (JDBC) in my SQLCreator. The statement below results in an error Incorrect syntax near ','. 

 

What am I doing incorrectly in this statement?

IF($(check_choice) LIKE "%BUA Road RTY%",SELECT * FROM dbo.[BUILT_UP_AREA_S])

 

icon

Best answer by dustin 6 March 2023, 15:26

View original

1 reply

Userlevel 3
Badge +26

Turns out I was over-complicating. The statement I was looking for was:

SELECT * FROM dbo.[BUILT_UP_AREA_S] WHERE '$(check_choice)' LIKE '%BUA%'

 

Reply