NetTalk Central

Author Topic: Modify the lookup procedure?  (Read 3542 times)

jking

  • Sr. Member
  • ****
  • Posts: 422
    • View Profile
    • Email
Modify the lookup procedure?
« on: March 18, 2025, 12:03:09 PM »
Hello everyone,

     I have a client that no longer wants to store dates in his app.  Instead, he wants to store the number of days from a reference date.  I thought I would set a new field to store the number of days and set it as a lookup.  The lookup would call a procedure/memory form that allows the user to enter two dates and calculates the days between them.  This new calculated value should drop into the lookup field.  I use local variables on the memory form to store the dates and do the calculation. 
     I have the memory form called and it calculates the interval between the two dates.  However, upon returning to the lookup field, the interval value is not dropped into the lookup field.  I realize the lookup feature is meant to do a look up into a table but I thought I might be able to get it to do this by setting the lookup field in an embed, just before returning to the lookup field, but so far not able to do this.  Any thoughts on how to make this work or an alternate way to do this?  I prefer the lookup method over adding a button after each field and calling the memory form that way.  That would be too many buttons to add as I have about 30 date fields to convert.

Thanks,

Jeff King

rjolda

  • Sr. Member
  • ****
  • Posts: 354
    • View Profile
    • Email
Re: Modify the lookup procedure?
« Reply #1 on: March 18, 2025, 03:26:27 PM »
HI Jeff,
What you are trying to do is very unclear!  However, under the Client-Side tab for the field you when refresh Prompt, value and comment.  Also, When the field is accepted, You cn send new value to server and underneath that is a list of Objects to be RESET.  So, if you have calculated your value but not reset the object, then it won't display. 
Ron

jking

  • Sr. Member
  • ****
  • Posts: 422
    • View Profile
    • Email
Re: Modify the lookup procedure?
« Reply #2 on: March 19, 2025, 10:41:33 AM »
Hello all,

     I continue to work on this, now I'm taking a different route.  I have a button next to a field that calls a memory form.  See the attached image.  The form has two date fields and a third numeric field.  I want to enter the two dates and then populate the numeric field with the difference between the two dates.  In the ValidateAll embed I have the following:

loc:DateInterval = loc:ReferenceDate - loc:TargetDate

For the ReferenceDate and TargetDate fields, I have set these to reset the loc:DateInterval field on the client-side tab.  Still, the loc:DateInterval field is not filled in.  I suspect my embed code is wrong and/or I'm using the wrong embed.  Can anyone help with this?

Thanks,

Jeff King

rjolda

  • Sr. Member
  • ****
  • Posts: 354
    • View Profile
    • Email
Re: Modify the lookup procedure?
« Reply #3 on: March 19, 2025, 04:25:17 PM »
HI Jeff,
sometimes the Display field drives me nuts.  I would put a p_Web.Trace(' calculated value:' & loc:DateInterval ) when the calculation is done.  I suspect that the calculation is done on the Server side when the second date is entered. That is where I would put the trace.  If you get the correct value in the trace, then your math is correct - it is simply a display issue.  Some of these forms go in and out of scope so many times, I find it is easier to place the value in p_web.SSV('loc:DateInterval' , loc:DateInterval ).  I would then repeat the trace with p_Web.Trace(' calculated value:' & p_web.GSV('loc:DateInterval') ).  If you are getting the correct value then try displaying the Session value for  loc:DateInterval.  That would be my suggestion as to how to see what is going on.  Trace really helps sort these things out.
Ron

jking

  • Sr. Member
  • ****
  • Posts: 422
    • View Profile
    • Email
Re: Modify the lookup procedure?
« Reply #4 on: March 20, 2025, 04:33:10 AM »
Ron,

     Thanks for the replies.  I'll try your advice and get back to you.

Jeff

rjolda

  • Sr. Member
  • ****
  • Posts: 354
    • View Profile
    • Email
Re: Modify the lookup procedure?
« Reply #5 on: March 20, 2025, 01:00:48 PM »
HI Jeff,
You will need to run a debugger program to see the TRACE statements. 
When I am not wanting to run a debugger, and I am lazy, I just put in a message statement with a display of the variable field and its value. My message windows are set to time out after 3 seconds so they will auto close and the program will keep running.
Yes, I always get the ruler smashed across the knuckles but this is sometimes a quick way to get an answer to a simple problem!
Ron

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11297
    • View Profile
Re: Modify the lookup procedure?
« Reply #6 on: March 23, 2025, 09:00:21 PM »
>> You will need to run a debugger program to see the TRACE statements. 

I recommend DebugView++. It's not a debugger, it's a message viewer.

>> I am lazy,

hard to see how it's less work than a single double-click.

Bruce


Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11297
    • View Profile
Re: Modify the lookup procedure?
« Reply #7 on: March 23, 2025, 09:03:03 PM »
>> I have a client that no longer wants to store dates in his app.  Instead, he wants to store the number of days from a reference date.

I strongly recommend you use Dec 28th, 1800 as the reference date. If you do this then there's effectivly nothing to do, just store the date as a LONG.

Cheers
Bruce