DragonRAD Forum
June 19, 2013, 09:39:05 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Devide ID/Pin  (Read 813 times)
jmostert
Member
*
Posts: 8


View Profile
« on: September 09, 2011, 02:22:24 AM »

Hi,

Is it possible to access the device ID/Pin via a textbox (or other control)? I'd like to be able to see which device uploaded each record.

Thank you and regards,

Johan
Logged
YiLiu
Seregon
****
Posts: 202


View Profile
« Reply #1 on: September 09, 2011, 06:44:54 AM »

Hi Johan,

Yes, you can. Steps:

(1) Drop a text box into the form.
(2) at the onload actions of form, put the following script into.

mypin = client.pin

--client.alert(mypin)

myform = clientevent.form

mytextbox = myform.fields["textboxfieldID"]

--client.alert(mytextbox)

mytextbox.value = mypin

Logged
jmostert
Member
*
Posts: 8


View Profile
« Reply #2 on: September 09, 2011, 07:16:36 AM »

Hi Yi,

Thank you for the prompt feedback. It works perfectly.

Just another questions: I have a transaction date that I want to set on the Form Load. What is the Lua function to set the date to today's date and time? I know in SQL it's getdate() and in VB its today(), but I've never used it in Lua.

Thank you and regards,

Johan
Logged
YiLiu
Seregon
****
Posts: 202


View Profile
« Reply #3 on: September 09, 2011, 07:35:49 AM »

Hi Johan,

You might try some similar as the following:

local myFields = clientevent.form.fields
local curtime = os.time()

-- client.alert(curtime)

-- if you want to set value to a date field, you do not need to convert the curtim to string
mycurtimestring = os.date("%X" , curtime)  -- if you like different format, please refer www.lua.org/pil/22.1.html for detail
myFields["textboxField"].value = mycurtimestring

Kind Regards,

Yi
Logged
jmostert
Member
*
Posts: 8


View Profile
« Reply #4 on: September 10, 2011, 02:22:05 AM »

Hi Yi,

Thank you again. It works perfectly; it's exactly what I was looking for.

Regards,

Johan
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!