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



  • 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



  • 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'))
    


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



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

    topofthepage.dateinstallationcalendar
    

    Using the right id, of course.



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



  • This post is deleted!


  • 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 ;-)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.