NetTalk Central

Author Topic: variable will not accept time picture  (Read 5325 times)

cwtart

  • Full Member
  • ***
  • Posts: 130
    • View Profile
    • CommPay Software
    • Email
variable will not accept time picture
« on: October 02, 2013, 09:33:00 AM »
C8 9661 NT 7.20

I have a memory form with a local long variable to be used for time entry. I have tried several different time pictures and when the field is tabbed out of the time is displayed correctly. But the value never reaches the validate embed when I click the save button. The value almost always changes to 1 - that's the number 1 - this is regardless of what time I enter. If I remove the time picture and have no field picture at all I can enter any value and it reaches the validate embed correctly - something does not like the time picture formatting.

This is a popup form but it does the same thing with a standard form.

Is this a bug or am I doing something wrong?

Chuck

cwtart

  • Full Member
  • ***
  • Posts: 130
    • View Profile
    • CommPay Software
    • Email
Re: variable will not accept time picture
« Reply #1 on: October 02, 2013, 10:44:24 AM »
In addition to this problem I tried to run the TimeFields(35) example app looking for clues but it crashes with an exception as soon as a browser requests a page.

Chuck

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: variable will not accept time picture
« Reply #2 on: October 03, 2013, 02:14:38 AM »
did you add the StringTheory extension to the timefields example?

Is there any embed code in your form?

cheers
Bruce

cwtart

  • Full Member
  • ***
  • Posts: 130
    • View Profile
    • CommPay Software
    • Email
Re: variable will not accept time picture
« Reply #3 on: October 03, 2013, 04:36:29 AM »
Bruce,

I will add StringTheory to the example and try that but, yes, there is embed code in my form. I am presetting the values of the local variable in the GenerateForm embed. And I have embeded code in the ValidateAll embed (have also tried the validate update embed).

I have also done this - I put a stop in the field add-server-side code to check the value - the value is correct there but when save is clicked the value had changed in the validate all (or validate update) embed.

Chuck

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: variable will not accept time picture
« Reply #4 on: October 03, 2013, 05:24:46 AM »
>> there is embed code in my form. I am presetting the values of the local variable in the GenerateForm embed.

take that out and use the Priming tab in the template instead.

>> And I have embeded code in the ValidateAll embed (have also tried the validate update embed).

comment this out, and see if the behavior changes.

cheers
Bruce

cwtart

  • Full Member
  • ***
  • Posts: 130
    • View Profile
    • CommPay Software
    • Email
Re: variable will not accept time picture
« Reply #5 on: October 03, 2013, 06:08:31 AM »
Bruce,

I cannot comment-out the ValidateAll embed - this is where I fetch a record from a table and update a field with the value of the local field on the memory form.

Chuck

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: variable will not accept time picture
« Reply #6 on: October 03, 2013, 06:16:25 AM »
are you setting the session values here? not local values.

cwtart

  • Full Member
  • ***
  • Posts: 130
    • View Profile
    • CommPay Software
    • Email
Re: variable will not accept time picture
« Reply #7 on: October 03, 2013, 07:01:17 AM »
Bruce,

This seemed so simple at the start - here is the detail of what I am trying to do:

On a "master" memory form I have a button that "calls" the memory form I am having the problem with. The "call" to the memory form is on the button "onclick" tab by selecting the procedure from the drop list. Popup is checked, Include Action is checked, Action = Change

Then on the called form I am priming the two local LONG variables that are added to the form as strings with the picture '@T3B'. The priming is done on the Priming tab with this code:

Local:StartTime = p_web.GSV('CurrentJobStartTime') and Prime For Change is checked.
Local:EndTime = p_web.GSV('CurrentJobEndTime') and Prime For Change is checked.

When the form displays, Local:StartTime is displayed correctly with the value that is set in the "Master" form. But Local:EndTime always shows 12:00AM when Local:EndTime = 0. If Local:EndTime is set to something other than zero then the time displays correctly for the primed field.

For the Save button I have the embeded code in the ValidateUpdate embed. In the ValidateUpdate embed I fetch the table record that I want to update and retrieve Local:StartTime and Local:EndTime by getting their session values. At this point, in the ValidateUpdate embed, Local:StartTime and Local:EndTime _always_ display (by using Message(format(Local:StartTime,@T3B)) as 12:00AM regarding of the value showed in the form fields.

I am stumped.

Chuck



Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: variable will not accept time picture
« Reply #8 on: October 03, 2013, 10:02:10 PM »
a small example would probably help. Debugging from descriptions is pretty much impossible (at least for me.)

cheers
Bruce

cwtart

  • Full Member
  • ***
  • Posts: 130
    • View Profile
    • CommPay Software
    • Email
Re: variable will not accept time picture
« Reply #9 on: October 04, 2013, 05:35:06 AM »
Bruce,

Here is what I have found so far:

When the save button is clicked I have tracked this to RestoreMem Routine

p_stage = of Net:ChangeRecord + NET:WEB:StageValidate

  RestoreMem is called here and p_web.IfExistsValue('Local:EditFormStartTime') returns True
  so  Local:EditFormStartTime = p_web.dformat(clip(p_web.GetValue('Local:EditFormStartTime')),'@T3B')
  is used to set the value of Local:EditFormStartTime

BUT p_web.GetValue('Local:EditFormStartTime') is already deformated at this point so the deformatting of an already deformated value is returning the wrong value.

When p_stage  = of Net:ChangeRecord + NET:WEB:StageValidate should GetValue exist at this point?
 
Chuck

cwtart

  • Full Member
  • ***
  • Posts: 130
    • View Profile
    • CommPay Software
    • Email
Re: variable will not accept time picture
« Reply #10 on: October 04, 2013, 09:01:54 AM »
The extra deformating of the variable in RestoreMem is definitely causing the problem so I created a dirty little work around by modifying the RestoreMem Routine to this:

  if p_web.IfExistsValue('Local:EditFormStartTime') And Not Numeric(p_web.GetValue('Local:EditFormStartTime'))
    Local:EditFormStartTime = p_web.dformat(clip(p_web.GetValue('Local:EditFormStartTime')),'@T3B')
    p_web.SetSessionValue('Local:EditFormStartTime',Local:EditFormStartTime)
  Elsif p_web.IfExistsSessionValue('Local:EditFormStartTime')
    Local:EditFormStartTime = p_web.GetSessionValue('Local:EditFormStartTime')
  End
 
  Exit

This added line:  And Not Numeric(p_web.GetValue('Local:EditFormStartTime'))
  prevents the deformat if the variable is still formated to '@T3B'

Chuck

cwtart

  • Full Member
  • ***
  • Posts: 130
    • View Profile
    • CommPay Software
    • Email
Re: variable will not accept time picture
« Reply #11 on: October 04, 2013, 09:04:46 AM »
mistake in previous post:

this line

This added line:  And Not Numeric(p_web.GetValue('Local:EditFormStartTime'))
  prevents the deformat if the variable is still formated to '@T3B'

should be

This added line:  And Not Numeric(p_web.GetValue('Local:EditFormStartTime'))
 prevents the deformat if the variable is no longer formated to '@T3B'

Chuck

Chuck