Hello Friends,
I’m trying to insert a new row using the button. When I’m passing all values then inserted a new row properly but I’m not passing any value then the below error occurs.
java.lang.NullPointerException
java.lang.NullPointerException: java.lang.NullPointerException
When I’m not passing any value then automatically added NULL value for the particular column. Please can you suggest to me how it is possible?
I’m using the below code for the inserted a new row.
name = event.source.parent.getComponent(‘Name’).text
details =event.source.parent.getComponent(Details
).text
date = event.source.parent.getComponent(‘date’).date
table = event.source.parent.getComponent(‘Table’)
insertQuery = ‘INSERT INTO Sample (name, details, date) VALUES(?,?,?)’
args = [name, details, system.date.format(date, “yyyy-MM-dd HH:mm:ss”)]
system.db.runPrepUpdate(insertQuery, args)
system.db.refresh(table, “Data”)
Thanks,
Priyanka