139
Views
23
Comments
Solved
SQL Query is working in Dev env when testing but when I test it in actual, it fails.

I have a SQL Query which has a parameter with it's Expand Inline property set to yes, containing additional query, when I execute this query with test inputs, it works fine and gathers data, but when I test this using the site I get an Error.

Error: *I'm on breakpoint

This is my query:

This is my input for in SQL Query:


UserImage.jpg
Wilbye Descalsota
Solution

Wilbye Descalsota wrote:

Wilbye Descalsota wrote:

Raphael Ranieri wrote:

Seems like your error is not related to the filter.

It is related with the empty fields in the end of your select '','','' but it is a strange error.

What DataBase are you using SQL, Oracle?

 

 same suspicion, I'm using mariadb

 

 I tried putting numbers ('1','2','3','4') in the '' selects and it works, what would be the best practice for this.

 now what I did is the 4 '' selects is named after their structure attribute name. Is this okay?

2018-06-05 16-54-03
Maria da Graça Peixoto

Hi Wilbye, 

Have you tried to replace   ""   by '    in you SQL Query parameter value?

Just an idea. 

Graça


UserImage.jpg
Wilbye Descalsota

Maria da Graça Peixoto wrote:

Hi Wilbye, 

Have you tried to replace   ""   by '    in you SQL Query parameter value?

Just an idea. 

Graça


 

 Tried this solution, same outcome, works on testing but I still get the error on actual execution

UserImage.jpg
Pankaj Jain

Hi Wilbye,


Can you please try blow input parameter :

"{applicant_details}.[full_resume] LIKE '%business%' AND {applicant_details}.[full_resume] LIKE '%analyst%'"

Here I just put single quote for like parameter. I am sure it will work.


But be cautious, setting Expand Inline to yes can lead to security thread so be careful.


Thanks

Pankaj 

UserImage.jpg
Wilbye Descalsota

Pankaj Jain wrote:

Hi Wilbye,


Can you please try blow input parameter :

"{applicant_details}.[full_resume] LIKE '%business%' AND {applicant_details}.[full_resume] LIKE '%analyst%'"

Here I just put single quote for like parameter. I am sure it will work.


But be cautious, setting Expand Inline to yes can lead to security thread so be careful.


Thanks

Pankaj 

 

 Tried this solution, same outcome, it works on testing but I get error on actual execution

2026-01-26 10-25-31
Lennart Kraak
Champion

Hi Wilbye,

Also change the -- comment in your advanced query. This works while testing the query, but won't when it's used in runtime. Outsystems creates an SQL command out of the query with the query in 1 line. In this case, the -- breaks the query. Use /* comment */ instead.


Regards,
Lennart

UserImage.jpg
Pankaj Jain

Lennart Kraak wrote:

Hi Wilbye,

Also change the -- comment in your advanced query. This works while testing the query, but won't when it's used in runtime. Outsystems creates an SQL command out of the query with the query in 1 line. In this case, the -- breaks the query. Use /* comment */ instead.


Regards,
Lennart

Hi Lennart,

May be you right, but I added both types of comments in OutSystems11 and it is working fine without error.


Thanks
Pankaj.

 

UserImage.jpg
Wilbye Descalsota

Lennart Kraak wrote:

Hi Wilbye,

Also change the -- comment in your advanced query. This works while testing the query, but won't when it's used in runtime. Outsystems creates an SQL command out of the query with the query in 1 line. In this case, the -- breaks the query. Use /* comment */ instead.


Regards,
Lennart

 

 Didn't work for me

2021-07-07 13-36-32
Hans Dollen

Hi Wilbye, 

Do you really need an expand inline with a dynamic query, or can you use an aggregate for it? 

Else, see the remarks above. 

Kr Hans



UserImage.jpg
Wilbye Descalsota

Hans Dollen wrote:

Hi Wilbye, 

Do you really need an expand inline with a dynamic query, or can you use an aggregate for it? 

Else, see the remarks above. 

Kr Hans



 

 I'll do this as a last resort, I'll look for other solutions first.

2020-11-10 23-58-16
Raphael Ranieri
 
MVP

Hi Wilbye,


Can you execute the query again and go to the executed query table and post a screen shot?

This way we can see what the SQL is trying to execute for real.

To see the tab just click there after executing it as a test:


Cheers and Regards,

RR :)

UserImage.jpg
Wilbye Descalsota

Raphael Ranieri wrote:

Hi Wilbye,


Can you execute the query again and go to the executed query table and post a screen shot?

This way we can see what the SQL is trying to execute for real.

To see the tab just click there after executing it as a test:


Cheers and Regards,

RR :)

 

 Here is the screenshot after testing the query:

2020-11-10 23-58-16
Raphael Ranieri
 
MVP

Oh...
Sorry Wilbye, I miss understood, you CAN run it as a test and CAN'T in runtime. Is that right?


I thought it was the opposite.


If this is the case you can show us the log in service center about this error?

UserImage.jpg
Wilbye Descalsota

Raphael Ranieri wrote:

Oh...
Sorry Wilbye, I miss understood, you CAN run it as a test and CAN'T in runtime. Is that right?


I thought it was the opposite.


If this is the case you can show us the log in service center about this error?

 

 Yes, that is correct. Here is the image from the Service Center Error Log:


2020-11-10 23-58-16
Raphael Ranieri
 
MVP

Seems like your error is not related to the filter.

It is related with the empty fields in the end of your select '','','' but it is a strange error.

What DataBase are you using SQL, Oracle?

UserImage.jpg
Wilbye Descalsota

Raphael Ranieri wrote:

Seems like your error is not related to the filter.

It is related with the empty fields in the end of your select '','','' but it is a strange error.

What DataBase are you using SQL, Oracle?

 

 same suspicion, I'm using mariadb

2020-11-10 23-58-16
Raphael Ranieri
 
MVP

Ok I see...

As you are using MariDb some rules must be different.

What you should get after executing it using SQL or Oracle would be something like that:



Notice that the entities that were {Entity}.[Attribute] in the SQL tab, changes to [DBName].DBO.[Table].[Column]


However in your case, it uses simple quotes when changing the SQL text, going to 'Table'.'Column'. You can see it in the executed SQL print you posted.

It must be some particularity of MariaDB, and when you use the empty fields in the end of your select, as '' it must understand that it is a table or column,


It is possible to remove then?
And try to execute again?

2020-11-10 23-58-16
Raphael Ranieri
 
MVP

If it is not possible to remove... try to use NULL instead of '' 


See if it works

UserImage.jpg
Wilbye Descalsota

Raphael Ranieri wrote:

If it is not possible to remove... try to use NULL instead of '' 


See if it works

 

 I also tried this, and I got the same error in logs, (Duplicate Column) so I think naming the columns after their attribute is the answer

2020-11-10 23-58-16
Raphael Ranieri
 
MVP

Yes! Sure!

This actually might work too!

This way the DB will not think it is the same column...

Try it, if it works it is ok to use like this... Will not be a problem! :)

UserImage.jpg
Wilbye Descalsota

Thank you everyone for the help!

2020-11-10 23-58-16
Raphael Ranieri
 
MVP

Cool!! :)
Happy to help!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.