Python Forum
[PyQt] display the contents of the table in descending order of the date
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyQt] display the contents of the table in descending order of the date
#11
Okay those are example queries -- which means they are designed based on "semi-standard" SQL Statements -- this then means that you need to validate how those queries would need to be composed within your database because standards are not always adhered to by all databases -- so it is always a good idea to take the query and run it directly from within your database engine interface to see if it works and then fix any issues there before putting it within your actual code base -- also always always take anything posted by anyone as a guideline not a verbatim as most folks are not going to be working with your actual setup so there may be differences that you need to adjust for.
Reply
#12
hi; here is the image reflecting part of my application :
[Image: shvd.png]

here is a function with which the user can enter the dates of the readings :

def display_date_loc35R(self):
        try:
            d = int(self.lineEdit_day_loc35R.text())
            m = int(self.lineEdit_month_loc35R.text())
            y = int(self.lineEdit_year_loc35R.text())
            date = dt.date(y, m, d)
        except ValueError:
            self.textEdit_eror_display_loc35R.setText('<span style="color:#FF0000; font-weight: bold;font-size:15px;">Un des champs spécifique à la date est vide ou invalide.</span>') 
        else:
            self.lineEdit_complete_date_loc35R.setText("{:%Y/%m/%d}".format(date))
            self.textEdit_eror_display_loc35R.setText('<span style="color:green; font-weight: bold;font-size:15px;">The date stored in the DB and in the parts for inserting and displaying the measurement readings is in the form (year/month/day)</span>') 
as i did not find how to make a ranking for the dates with the french version in decreasing order, i chose the easiest solution: it is to indicate to the user that the dates are stored in the data base in the form (year / month / day)
Reply
#13
Well based on how dates are actually usually stored in database the year, month, day order is probably the most accurate when referencing a date in that way but technically they are not stored in that order at all as they are stored as a numeric value that represents the time since a certain base date and then are sorted numerically

I mention this because this is why it is totally irrelevant as to how a date is displayed as that is only a human readable version of the actual stored value - and this is not just applicable to dates as sometimes other values are stored in one format and displayed in another because it is more efficient to store them that way and then just translate them when needed to be viewed by a human as the computer does not care it can work with those base values and understand them as is.
Reply
#14
Thank you for these explanations-
Reply
#15
@atlass218 okay because I am helping numerous folks with numerous issues can you remind me where we are at with yours so that I can maximize my help time to have its greatest effect
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyQt] How do I display the DB table I will choose from the QComboBox in QTableWidget JokerSob 2 2,302 Aug-05-2021, 03:00 PM
Last Post: JokerSob
  [PyQt] manage display date atlass218 2 1,736 Nov-11-2019, 09:41 PM
Last Post: atlass218
  Display and update the label text which display the serial value jenkins43 5 9,068 Feb-04-2019, 04:36 AM
Last Post: Larz60+
  Display more than one button in GUI to display MPU6000 Sensor readings barry76 4 3,883 Jan-05-2019, 01:48 PM
Last Post: wuf
  [PyQt] How to display multiple data(from 2 different related table) in one cell of QTableWid yangjae 4 4,374 Oct-17-2018, 07:54 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020