Replies: 7 comments
-
I made a small example: https://replit.com/@pimaj62145/SQLPage-Time-series-example?v=1 let me know if it helps |
Beta Was this translation helpful? Give feedback.
-
will this load the data from the db based on the date selected ? because in initial load for the todays date, even though there is value, it didn't get populated. |
Beta Was this translation helpful? Give feedback.
-
Yes, look at the code! SELECT 'list' AS component, 'Events' AS title;
SELECT event_datetime AS title,
event_description as description,
'calendar' as icon
FROM events
WHERE event_datetime BETWEEN $Date AND date($Date, '+1 day'); The code is for SQLite, you'll need to adapt the syntax if you're using a different database. |
Beta Was this translation helpful? Give feedback.
-
yes i`m using postgresql. |
Beta Was this translation helpful? Give feedback.
-
You'll have to use postgres date and time functions, then. |
Beta Was this translation helpful? Give feedback.
-
i tried couple of changes for below code to work with postgresql, but there is an error. can u help with that, SELECT
'Date' AS name,
'date' AS type,
COALESCE($Date, date('now')) AS value,
TRUE as required; how is the date value set in postgresql |
Beta Was this translation helpful? Give feedback.
-
Postgres requires you to be more careful with data types than in SQLite when writing your queries. I published a live working example here: https://replit.com/@pimaj62145/SQLPage-Postgres-Time-series-example?v=1 SELECT
'Date' AS name,
'date' AS type,
date(COALESCE($Date, 'now')) AS value,
TRUE as required;
----------------------------------
-- Display public rna sequences released on the selected date
SELECT 'list' AS component, 'Events' AS title;
SELECT timestamp AS title,
description as description,
'calendar' as icon
FROM rnc_rna_precomputed INNER JOIN rnc_release on rnc_rna_precomputed.last_release=rnc_release.id
WHERE release_date BETWEEN date($Date) AND date($Date) + INTERVAL '1 day'
LIMIT 10; |
Beta Was this translation helpful? Give feedback.
-
Hi I have a table with date as a column. My requirement is,
Is it possible to achieve this with SQLPage. I tried to check with couple of examples, but couldn't find with this requirement.
Thanks
Althaf
Beta Was this translation helpful? Give feedback.
All reactions