Filter a table by tag from a text field

Hi, I trying to filter a table, the data come from a transaction group, and the table is named “group_table”, then i have a text field for enter the name of a tag.

I have this on the table:

[color=#FF0000]SELECT {Root Container.Text Field.text}, t_stamp from group_table[/color]

This is funcional but when the textfield doesn’t have a string i receive an error “you have and error en your sql sintax”

i don’t know if is there a better way to do this, please help.

Try this:

SELECT IF('{Root Container.Text Field.text}'='',NULL,{Root Container.Text Field.text}), t_stamp from group_table

[b]That did not work either, is there a way to read all the tag whitout a transaction group?

I keep getting the error [color=#4000FF]when the text field is empty

and when there is no tag on the transaction group with that name [/color]

I have realistic3 and realistic4 in the transaction group, when I write other name like realistic5 I got and error[/b]

You need to use a Drop Down list instead of the text field. And you should look at the field names in the table and only use those field names, then change your SQL:

SELECT IF('{Root Container.Dropdown.selectedStringValue}'='',NULL,{Root Container.Dropdown.selectedStringValue}), t_stamp from group_table

My table look like this:

Now, how I can populate the drop down list with the tag names from the transaction group with a sql query? this is and example with two tags but if in a project I have more than 1000 tags, I have to put them one by one?

You could create a new table and put the list of tags in the table.

how can i do that? can you give me and example inserting tag names into a db? the use of sql query is new for me and i trying to create new functionalities.

Create the table:

CREATE TABLE field_table (fieldname VARCHAR(255) PRIMARY KEY(fieldname))

Add a new row to the table:

INSERT INTO field_table (fieldname) VALUES ('Realistic3')

Use this in the Dropdown:

SELECT fieldname AS Value, fieldname AS Label FROM field_table SORT BY fieldname

For the rest, it’s better for you to work with it and learn as much as you can.

I appreciate your help, that might work but I still have to insert the tags one by one and if I have 1000 tags the idea is not to spend time to do that. I still looking for another choice.