Skip to content

Loading Table with as default date and Searching table with a datepicker form. #76

Description

@althaf004

Hi I have a table with date as a column. My requirement is,

  1. When the page is initially loaded, the select query to the table has to send with a default date like today. and display results based on that query.
  2. I will have a datepicker to the top of the page, where if i needed to run the query for a different date the table has to be filled with the data of that particular date.

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

Activity

  1. lovasoa commented on Aug 30, 2023

    @lovasoa
    Collaborator

    I made a small example: https://replit.com/@pimaj62145/SQLPage-Time-series-example?v=1

    let me know if it helps

  2. althaf004 commented on Aug 30, 2023

    @althaf004
    Author

    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.

  3. lovasoa commented on Aug 30, 2023

    @lovasoa
    Collaborator

    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.

  4. althaf004 commented on Aug 30, 2023

    @althaf004
    Author

    yes i`m using postgresql.

  5. lovasoa commented on Aug 30, 2023

    @lovasoa
    Collaborator

    You'll have to use postgres date and time functions, then.

  6. locked and limited conversation to collaborators on Aug 30, 2023
  7. converted this issue into a discussion #78 on Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions