I have built a charts through querying my table that basically lists type of expense (food, services, etc). The chart works perfectly… But I have not been able to condition it to the data entered by each user. User independent shows all table data on expense type. Through User Records Management I have configured it so that each user sees his own records… but the chart shows him all the data, not what he has recorded.
I have tried configuring the query with WHERE and AND, through the User ID, I tried through Query_params but it hasn’t worked for me. I appreciate if you can give me some help. @willvin
Hello my friend, Thank you!!! It worked perfectly following your recommendation. However, I tell you that it worked for me in the Record Count module, I applied the query that you indicated and it works instantly… But I try to use a Chart and in the chart if it doesn’t work, and I’m using the same table, I don’t know If it’s because I’m grouping the field options there… could you shed some light on it, because it didn’t work there.
SELECT COUNT(Viaticos.id) AS count_of_id, Viaticos.asignacion FROM Viaticos GROUP BY Viaticos.asignacion WHERE user=:user
I am using the same way to record user’s account with the record method shown above. However, If the user is new and never had any record, it should return 0. However, I am getting error message for the null response. I wanted to add a code to check the output is null or number and couldn’t do that from the window above to add the code. How to handle such issues?
it is possible if you can write your query to pull the specific data you want to use and then pass it to the parameter. Note, that this auth()->user()->id is automatically handled by the app, more like a session. you cannot call tax()->tax_id unless you have created such a function to pull your tax data.