Wappler 5 beta 6, Windows, Php, Mysql (MariaDB).
Hi, I’m stuck with the following case:
I have a table that work as config file to allow me for example;
If I fixing some issue, or a simple update of UI my config table is:
id, valor, condicion
1,mantenimiento_general,0
2,mantenimiento_pag1,0
3,mantenimiento_pag2,0
3,mantenimiento_pag3,0
If they realize, I have mantainment values in DB, if this changes to ‘1’ the propper page with a condicional region calling a php file that contain a mantainance message, and another conditional region if ‘0’ everthing work normal, in that way if I’m working in pag2 with just using form checks in backend allowing me to change that values from 1 to 0 and vice.
I guess this is a normal behavior, because is easy to change value from column “condicion” to 1 from my backend with a simple ‘Database update’ in server actions.
But now, I’m looking a way to change that and make it using json in the same table in database, for example using the column ‘condicion’ in type json(longtext for MariaDB):
id, valor, condicion
1, mantenimiento, {"general": "0", "pag1": "0", "pag2": "0", "pag3": "0"}
The idea is to make the config table better structured, using less rows keeping in mind that following the example of mantainments I use other variables to in same way to change other things in differents pages, this query is fact public, because is a config file, no sensitive info and nothing to compromise the DB is just a file to allow me control situations like mantainments, versions, themes, banners in a easy way.
But the problem that I have now is how to get the value of key ‘pag1’ from column ‘condicion’ where column ‘valor’ is ‘mantenimiento’.
How to obtain that value to get to work inside condicional region just like before with old common structure?.
And finally if obtained the value from the key of the json is possible, how I can partial update that json ‘condicion’ column for example only for the key ‘pag1’?.
I was reading a lot, but honestly I can’t get this to works,
Thanks
Last updated: