Sqlite en label

Hello, I have a table named “GastosDiarios” with columns “Fecha” (Date), “Categoria” (Category), and “Valor” (Value). I’m trying to perform various SQLite queries and display the results in different labels. For example:

  1. To show the total for the current month:

sqlCopy code

SELECT * FROM GastosDiarios WHERE strftime('%m', Fecha) = '12';
  1. Another query to display the sum of values grouped by category:

sqlCopy code

SELECT Categoria, SUM(Valor) as totGastos FROM GastosDiarios GROUP BY Categoria;

I need help with how to achieve this.

What happens, if you use one of those queries? Where exactly do you need help?
Please provide a screenshot of your relevant blocks

Taifun

“Thank you, Taifun! What I need to display are totals and calculations through queries similar to that one. For example, one value would be the total sum for the month, another the total sum of values with the ‘income’ category, etc. Then, perform some calculations such as dividing the total income by the number of days in the month. That’s why for each query, I want to display the result in a label. Only the value, so I would use, for example, two combined labels; one would be ‘Total Income:’ and in the second label, the value, for example, $100,000. I almost achieved the goal, but it shows the result like this: (TOT 100000), and I don’t want to display the field name or the parentheses.”

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select “Download Blocks as Image”. You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


Thanks friend, I almost have it with this module, I just need to control when it returns null that it doesn’t show anything.

How exactly does the result from the sql query look like in this case? Is it an empty list? ()

Taifun