Hi everyone,
I'm apparently a glutton for punishment.
I converted a component that mostly used xbasic to one that
uses only javascript (it does not even use a database).
From what I understand about console.log, it's functioning without errors,
yet it fails to display a populated viewbox.
I am sure this is something stupid I've done, but I can't for the life of me
figure it out.
The code is below (with irrelevant comment lines removed) and the component
is attached.
For me, this is a practical experiment working with javascript dates and of course,
the viewbox control.
Any help is greatly appreciated.
Gregg
I'm apparently a glutton for punishment.
I converted a component that mostly used xbasic to one that
uses only javascript (it does not even use a database).
From what I understand about console.log, it's functioning without errors,
yet it fails to display a populated viewbox.
I am sure this is something stupid I've done, but I can't for the life of me
figure it out.
The code is below (with irrelevant comment lines removed) and the component
is attached.
For me, this is a practical experiment working with javascript dates and of course,
the viewbox control.
Any help is greatly appreciated.
Gregg
Code:
function processChosenDate(gsDate){ var chosenDate = new Date(gsDate); console.log('chosen date = ' + chosenDate); var refDate = new Date('10/13/2012'); var refMS = refDate.getTime() //var chosenDate = new Date('12/23/2022'); var write = document.getElementById('selected'); var chosenDateMS = new Date(chosenDate).setHours(0,0,0,0); var aDay = 1000*60*60*24; var aPayperiod = aDay * 14; var pdiSpan = Math.floor((chosenDate-refDate)/aPayperiod ) var pdiBeg = new Date(pdiSpan * aPayperiod + refMS) var pdiBegMS = pdiBeg.getTime(); var pdiFin = new Date(pdiBegMS + (aDay*13) ) var pdiPaydate = new Date(pdiBegMS + (aDay*30) ) var pdiLastPaydate = new Date(pdiBegMS + (aDay*2) ) var pdiLastBeg = new Date(pdiBegMS - (aPayperiod*2) ) var pdiLastFin = new Date(pdiBegMS - (aDay*15) ) var pdiNextPaydate = new Date(pdiBegMS + (aDay*16) ) var pdiNextBeg = new Date(pdiBegMS - (aPayperiod) ) var pdiNextFin = new Date(pdiBegMS - (aDay) ) var pdData = [] console.log('pdiPaydate to ISOString : ' + pdiPaydate.toISOString().substring(0,10)); var dataRow = '{"category":"projected",' + '"paydate":"' +pdiPaydate.toISOString().substring(0,10)+'",'+'"periodbeg":"'+pdiBeg.toISOString().substring(0,10)+'",'+ '"periodfin":"'+pdiFin.toISOString().substring(0,10)+'"}' pdData.push(dataRow); dataRow = '{"category":"last",' + '"paydate":"' +pdiLastPaydate.toISOString().substring(0,10)+'",'+'"periodbeg":"'+pdiLastBeg.toISOString().substring(0,10)+'",'+ '"periodfin":"'+pdiLastFin.toISOString().substring(0,10)+'"}' pdData.push(dataRow); dataRow = '{"category":"next",' + '"paydate":"' +pdiNextPaydate.toISOString().substring(0,10)+'",'+'"periodbeg":"'+pdiNextBeg.toISOString().substring(0,10)+'",'+ '"periodfin":"'+pdiNextFin.toISOString().substring(0,10)+'"}' pdData.push(dataRow); console.log('pdData = ' + pdData); console.log('data type : ' + typeof(pdData)); var vbPTR = {dialog.Object}.getControl('resultsVB'); vbPTR.populate(pdData,false); console.log(vbPTR.data) }
Comment