Hi All,
I’m trying to create a log of users that have entered inside a building (in Vision, with some success).
- created SQL database called ‘users’ in MySQL workbench (completed)
- created SQL database called 'building_log" in MySQL workbench (completed)
- add new users based on a unique user id (primary key), username, department (completed)
- delete users based from the user database based on user id (completed)
next steps that I am having trouble with:
- operator enters their user ID into a text box (completed)
- clicks Audit momentary pushbutton (completed)
- named query searches a pre-existing database for a user id match (completed)
- accessing the returned data to fill text boxes of “username”, “department” (uncompleted)
- write to ‘building_log’ the data from the audit query plus a date-time timestamp
Search query
SELECT users.Username,
users.Department,
users.SecurityLevel
FROM users
WHERE users.BadgeID = :BadgeID
AuditButton (momentary pushbutton) script
data = event.source.parent.getComponent(‘Badge Log Table’).data
AuditBadgeID = event.source.parent.getComponent(‘BadgeIDAudit’).value
result = system.db.runNamedQuery(“Select”,{“BadgeID”:AuditBadgeID})
event.source.parent.getComponent(‘UsernameAudit’).text = result[“Username”]
Can someone let me know in the last line, what I am doing wrong to reference the query return?