Connect button to a database

Hello again everyone,

I tried to solve my previous problem and almost found the solution, but something strange happens : when I connect a button to my database, it disapears from the table.

I have a table connected to a group, with two buttons and two texts inside. I’m trying to show or hide the button according to a value inside the database. How can I do that ?

Thanks by advance

На сколько мне известно, это не возможно. Но вы можете использовать возможности БД и установить картинку в место кнопки. Для этого используйте в БД следующую конструкцию
As far as I know, this is not possible. But you can use the capabilities of the database and set the image in place of the button. To do this, use the following construction in the database

SELECT *,
CASE
WHEN field1='true' THEN 'имя картинки' ELSE 'имя картинки'
END button
FROM data LIMIT 0, -1

Okay, I’m not so sure I have clearly understood… Do you mean that the image will become a button ? Or do I have to add a button above ? I tried to connect the image to the database with some WHERE conditions, and it works, but it looks like adding some buttons above makes it complicated for flipabit, often it doesn’t shows all the elements, some are missing away when i re-open the file… I mean, the images just don’t show, they are still present but not shown…

@Michael

Michail, возможно-ли добавить вазможность установливать свойства для компонентов через БД.
может создать правило при обнаружени которого компонент будет применять значение к своим своиствам? property{visible=true}

Michail, is it possible to add the ability to set properties for components via the database.
can create a rule, upon detection of which the component will apply the value to its properties? property{visible=true}

SELECT *,
CASE
WHEN field1='true' THEN 'property{visible=true}' ELSE 'property{visible=false}'
END button
FROM data LIMIT 0, -1

Hi Vladimir_PV, I tried the visibility property with “Text Field” and didn’t work for me.

And in case you are going to take a look at it, can you show me how to set “Input Hint” property instead?
sql_case_visible.flp (21.2 KB)

image

Вы не так поняли мои комментарий, это было обращение к @Michael
Управление сувойствами через БД на данный момент не возможно.

You misunderstood my comment, it was addressed to @Michael
Managing properties through the database is currently not possible.

1 Like

The table is probably not designed correctly. Typically, a table on the screen contains a constant set of elements. This could be text, an image, a button, a checkbox or a drop-down list, etc.

Can you give an example from real life where different rows of the same table contain different sets of elements? Maybe there is a screenshot from the application?

Similar functionality will be added. So that you can bind any property (and even several properties) of a component with any field in the table, for example, link the visibility property of a component with the corresponding field in the database.

Here is a screenshot from an application called Habitica.

IMG_20240628_115105

We can create good habits, bad habits or good and bad habits (example : say the truth, you win points when you say the truth, you lose points when you say a lie). That’s the idea.

So I would like to create a list of habits, good and bad, with the corresponding button that would be hidden when the habit is good or bad only. That’s why i used a table connected to a database, with a field “good” and a field “bad”. Was there any other options ?

It’s clear now, thanks. I’ll make an example with a workaround using code.


Back to Flipabit >
Copyright © 2018. Flipabit Team. All rights reserved.