Mon. - Fri. 9 am - 5 pm Ask a Question
Remember me

How to show custom SQL Query?

4 months 1 week ago #1

  • Paal's Avatar
  • Paal
  • Posts: 6
Hi.
I would like to get some information from SQL Database and view it on a form page. I see there is a SQL Query in DataTag, but is it possible to customize this?

I've tried to run this SQL Query -> [SQL query = SELECT * FROM sg2qo_baforms_forms]
but nothing is displayed. I'm using this SQL Query command in a textfield.

My goal is to use this together with Conditional Logic Field and display a list of all the active forms.

Is this possible, or is it another way to do this.

Thank you.
-Paal

4 months 1 week ago #2

  • Paal's Avatar
  • Paal
  • Posts: 6
So I did some more testing and change the SQL query for test purposes and I entered this command into Balbooa form.

[SQL query = SELECT title FROM sg2qo_baforms_forms;] and I got some results. But the result is missing several rows.

If I run this command in my SQL program (dbeaver) I get result number 2 in the picture, but in the form I get number 1 from image.

No matter what I do I can't get more then one line of info.

Does Balbooa Form support standard SQL command or am I querying this the wrong way or in the wrong element?
I really need to pull some data from the database to my form.


4 months 1 week ago #3

  • Artem's Avatar
  • Artem
  • Posts: 9812
Hi there!

Sorry for the delay with a reply!

You can try in this way
[SQL query = SELECT title FROM sg2qo_baforms_forms WHERE id = 1;]
[SQL query = SELECT title FROM sg2qo_baforms_forms WHERE id = 2;]
[SQL query = SELECT title FROM sg2qo_baforms_forms WHERE id = 3;]
[SQL query = SELECT title FROM sg2qo_baforms_forms WHERE id = 4;]
[SQL query = SELECT title FROM sg2qo_baforms_forms WHERE id = 5;]
[SQL query = SELECT title FROM sg2qo_baforms_forms WHERE id = 6;]
[SQL query = SELECT title FROM sg2qo_baforms_forms WHERE id = 7;]
[SQL query = SELECT title FROM sg2qo_baforms_forms WHERE id = 8;]

Regards,
Artem, Balbooa.com

4 months 1 week ago #4

  • Paal's Avatar
  • Paal
  • Posts: 6
So, with this solution I will need to add one line after each new element in the database. I thought this command could pul data from database with the newest info all the time.

Perhaps I misunderstood.

Let me ask this;

If i would list all Joomla users from the database I would put in a command like this:

[SQL query = SELECT * FROM sg2qo_users;]

If I run this command only the first ID or the first User will be displayed in Balbooa Form. I would like all users to be visible and pulled from the database. What happens if I add another user? This will not automatically appear on my list until I add it there manually. THAT is what I don't want to do, manually add info.

So in short...I want to put in a SQL Query ( I know the command) that show all info in that table from the database. If another element gets added to the db this will appear on my list in the form.

Hope you understand. Thank you for response :)

-Paal

4 months 4 days ago #5

  • Vyacheslav's Avatar
  • Vyacheslav
  • Posts: 23004
Hello,

This won't work as it can only get one cell from the request
It doesn't work any other way

Best Regards,
Vyacheslav, Balbooa Support Team
Powered by Kunena Forum