Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. replacing date like '2018-01-01' by variable string on SQLITE query QML
Forum Updated to NodeBB v4.3 + New Features

replacing date like '2018-01-01' by variable string on SQLITE query QML

Scheduled Pinned Locked Moved Unsolved 3rd Party Software
7 Posts 2 Posters 1.0k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    filipdns
    wrote on last edited by
    #1

    Hello,

    I have JS query and QML calling the function and all is working fine is I write the date manually like here:

    JS.dbaddpart(inConversationWith,'2018-01-01')
    

    but when I'm trying to replace the date by variable like here:

    JS.dbaddpart(inConversationWith,dateaircraftpartinstallation)
    

    the query return nothing without error.

    the value of dateaircraftpartinstallation is from:

    Calendar {
                id:dateinstallationcalendar
                height:350
                width: 350
                anchors.verticalCenter: parent.verticalCenter
                anchors.horizontalCenter: parent.horizontalCenter
                focus: true
                visible:false
                onClicked:  {dateaircraftpartinstallation =Qt.formatDate(dateinstallationcalendar.selectedDate,'yyyy-MM-dd')
                    }
                style: TouchCalendarStyle {}
            }
    
    

    Do you know how can I solve this problem?

    Thank you very much

    Philippe

    1 Reply Last reply
    0
    • L Offline
      L Offline
      Leonardo
      wrote on last edited by
      #2

      Where's dateaircraftpartinstallation declared?

      If you have no other use for this property, you could also write

      JS.dbaddpart(inConversationWith, Qt.formatDate(dateinstallationcalendar.selectedDate,'yyyy-MM-dd'))
      
      1 Reply Last reply
      0
      • F Offline
        F Offline
        filipdns
        wrote on last edited by
        #3

        Hello at the top of the page i declare it with property string

        1 Reply Last reply
        0
        • L Offline
          L Offline
          Leonardo
          wrote on last edited by
          #4

          In my experience, using a fully qualified name is always safer. Whenever using dateinstallationcalendar, try:

          topofthepage.dateinstallationcalendar
          

          Using the right id, of course.

          1 Reply Last reply
          0
          • F Offline
            F Offline
            filipdns
            wrote on last edited by
            #5

            Using console.log I got the good value in the variable

            1 Reply Last reply
            0
            • F Offline
              F Offline
              filipdns
              wrote on last edited by
              #6
              This post is deleted!
              1 Reply Last reply
              0
              • F Offline
                F Offline
                filipdns
                wrote on last edited by
                #7

                I used the same variable for an other query and it's working...
                I'm little bit lost but I will check tomorrow it's too late for today ;-)

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved