Select to view content in your preferred language

Help in JScript

2501
4
Jump to solution
10-04-2012 12:58 PM
GustavoBediaga
Occasional Contributor
Hi,
I am new in Jscript, so I have a newbie question.
I downloaded the Initiate ID script, and made some changes on it to fit our company needs.

When I open Arcpad, it runs the code below (called in OnOpenMap, under System Object):

function InitiateID()
{
Application.UserProperties("ID") = Application.InputBox("Insira sua matrícula", "COMAR");
Application.UserProperties("ID_TABLET") = "DESKTOP"
}

Then when I select a feature to edit, and double click it, it shows me an error message:

"Error source unavailable
Error description unavailable
[Line: 4, Column: 2]
Source Text unavailable"

The script that produces the error is the following (called in OnLoad Event):

function GetID()
{
ThisEvent.Object.Controls("txtMAT_GEO").Text = Application.UserProperties("ID");
        ThisEvent.Object.Controls("txtID_TABLET").Text = Application.UserProperties("ID_TABLET")
}


I know it must be some silly detail, but I just can't work it out.

Thanks

Gustavo Bediaga

To be clear: I want the table field MAT_GEO to be populated with the Application.UserProperties("ID"), which is set up by user filling an InputBox opened when map is open. Then I want the other's table field ID_TABLET to be populated with the text DESKTOP.
Tags (3)
0 Kudos
1 Solution

Accepted Solutions
GustavoBediaga
Occasional Contributor
Still can't understand why It didn't work, but I have solved the problem!

I have just changed my object

ThisEvent.Object.Controls("txtIDTABLET").Text

with

Layer.Forms("EDITFORM").Pages("page1").Controls("txtIDTABLET").Text

and it worked!!!

Hope it helps someone else...

Gustavo

View solution in original post

0 Kudos
4 Replies
GustavoBediaga
Occasional Contributor
I have been testing many different ways to solve it, but I just can't work it out.

I have written the following code and called it in Onsetactive page event:

function GetIDTAB()
{
Application.Messagebox(Application.UserProperties("ID_TABLET"));
ThisEvent.Object.Controls("txtIDTABLET").Text = Application.UserProperties("ID_TABLET");
}

When I open the form page, it shows me a message box with the right Application.UserProperties("ID_TABLET") value, but it just don't set the txtIDTABLET control with this value!

The following script error is showed:

"Script Error 80004005
Error source unavailable
Error description unavailable
[Line: 4, Column: 2]
Source Text Unavailable"

Anyone can help me with that??

Thank you very much.

Gustavo Bediaga
0 Kudos
GustavoBediaga
Occasional Contributor
Still can't understand why It didn't work, but I have solved the problem!

I have just changed my object

ThisEvent.Object.Controls("txtIDTABLET").Text

with

Layer.Forms("EDITFORM").Pages("page1").Controls("txtIDTABLET").Text

and it worked!!!

Hope it helps someone else...

Gustavo
0 Kudos
RobertLugo
Deactivated User
Still can't understand why It didn't work, but I have solved the problem!

I have just changed my object

ThisEvent.Object.Controls("txtIDTABLET").Text

with

Layer.Forms("EDITFORM").Pages("page1").Controls("txtIDTABLET").Text

and it worked!!!

Hope it helps someone else...

Gustavo


Hi Gustavo.

I tried the same script and ran into similar problems as you did.  I used the line format you provide and was able to get it to work.
I couldn't figure out why the original line worked on the sample script but not on mine.  I did run into another problem and I'm curious to know if you also had a similar problem.  Once I ported the ArcPad project to my trimble unit I called up the apm and the form entry box poped up as expected. But I could not fill in the popup form entry box because I couldn't get the keyborad to come up until the form entry box cleared from the screen.  Does it behave this way with your gps unit.  I have a trimble juno sb with arcpad10.0
0 Kudos
GustavoBediaga
Occasional Contributor
Hi Gustavo.

I tried the same script and ran into similar problems as you did.  I used the line format you provide and was able to get it to work.
I couldn't figure out why the original line worked on the sample script but not on mine.  I did run into another problem and I'm curious to know if you also had a similar problem.  Once I ported the ArcPad project to my trimble unit I called up the apm and the form entry box poped up as expected. But I could not fill in the popup form entry box because I couldn't get the keyborad to come up until the form entry box cleared from the screen.  Does it behave this way with your gps unit.  I have a trimble juno sb with arcpad10.0


Because of the synchronization problems we are having with ArcPAD, we haven't implemented it in our field operations... We are still not sure if it will work properly.
At this moment, we are testing it in tablets computers, not GPS units, so I don't think I can help you.

Gustavo
0 Kudos