How do you compare values from database? Like closest date to current date from DB entries?

Support
  • I have managed it once with very workaroundish way but it was tough and not practical.

    Lets say I have database with 1000 entries, they all have few variables like username, password, DATE, record ID(obviously).

    so I use Foreach Loop > parse line (I assign these values to variables) > What I do now?

    I want to have records IDs of entries with date variable (basically date of creation that entry) that happened to be in current week.

    How can I achieve it?

    And how can I tell which one of these entries has closest date to now?

    How would I do it is to create a foreach, literate through each date and record id, then separate them into two lists, one for RECORD ID and one for DATE and then just compare dates with some javascript code idk choose the closest date to now, and then I will use record ID that has same index on second list that this date has on its own list..

    I mean i created these two lists so each date's record id WOULD be on the same index as date, but in different list.

    but as you can see - its really really workaroundish