NetTalk Central

Author Topic: local variables question  (Read 3614 times)

astahl

  • Sr. Member
  • ****
  • Posts: 308
    • View Profile
    • Email
local variables question
« on: August 26, 2015, 09:21:18 AM »
Hi All,

I have a file form that has a variable named loc:returnaddress and is populated as a text field on the form. On an update I want to display the data files separate address fields as a block of text. So I tried the PreUpdate routine to fill the local variable with the text from the separate fields from the database but nothing is displayed. So where would one call this routine to load the loc:returnaddress field

Routine looks like this;

LoadAddress     ROUTINE
  Access:production.Open()
  Access:production.UseFile()
  CLEAR(pro:Record)
  pro:job_id = CLIP(p_web.GSV('pro:job_id'))
  IF NOT Access:production.Fetch(pro:PRIMARY) THEN
    IF LEN(CLIP(pro:name)) THEN
      loc:returnaddress = CLIP(loc:returnaddress) & CLIP(pro:envelope_name) &'<13,10>'
    END
    IF LEN(CLIP(pro:company)) THEN
      loc:returnaddress = CLIP(loc:returnaddress) & CLIP(pro:envelope_company) &'<13,10>'
    END
    IF LEN(CLIP(pro:address2)) THEN
      loc:returnaddress = CLIP(loc:returnaddress) & CLIP(pro:envelope_address2) &'<13,10>'
    END
    IF LEN(CLIP(pro:address1)) THEN
      loc:returnaddress = CLIP(loc:returnaddress) & CLIP(pro:envelope_address1) &'<13,10>'
    END
    IF LEN(CLIP(pro:csz)) THEN
      loc:returnaddress = CLIP(loc:returnaddress) & CLIP(pro:envelope_csz) &'<13,10>'
    END
  END
  p_web.SetValue('loc:returnaddress',loc:returnaddress)
  p_web.SSV('loc:returnaddress',loc:returnaddress)
  Access:production.Close()  

  EXIT

Regards,

Ashley
« Last Edit: August 26, 2015, 09:23:02 AM by astahl »

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: local variables question
« Reply #1 on: August 26, 2015, 05:28:38 PM »
something like this? Some of you if statements could be failing

LoadAddress     ROUTINE
  Access:production.Open()
  Access:production.UseFile()
  CLEAR(pro:Record)
  pro:job_id = CLIP(p_web.GSV('pro:job_id'))
  IF NOT Access:production.Fetch(pro:PRIMARY) THEN
    IF LEN(CLIP(pro:name)) THEN
      loc:returnaddress = CLIP(loc:returnaddress) & CLIP(pro:envelope_name) &'<13,10>'
    END
    IF LEN(CLIP(pro:company)) THEN
      loc:returnaddress = CLIP(loc:returnaddress) & CLIP(pro:envelope_company) &'<13,10>'
    END
    IF LEN(CLIP(pro:address2)) THEN
      loc:returnaddress = CLIP(loc:returnaddress) & CLIP(pro:envelope_address2) &'<13,10>'
    END
    IF LEN(CLIP(pro:address1)) THEN
      loc:returnaddress = CLIP(loc:returnaddress) & CLIP(pro:envelope_address1) &'<13,10>'
    END
    IF LEN(CLIP(pro:csz)) THEN
      loc:returnaddress = CLIP(loc:returnaddress) & CLIP(pro:envelope_csz) &'<13,10>'
    END
  END
  If loc:returnaddress = ''
    loc:returnaddress = 'No Address pro:job_id = ' & CLIP(p_web.GSV('pro:job_id'))
  End
  p_web.SSV('loc:returnaddress',loc:returnaddress)
  Access:production.Close()   

  EXIT

astahl

  • Sr. Member
  • ****
  • Posts: 308
    • View Profile
    • Email
Re: local variables question
« Reply #2 on: August 27, 2015, 02:20:39 AM »
Hi Kevin,

You absolutely correct!!! I was looking at the wrong fields in my IF statements. Better sometimes to walk away and give the eyes and brain a rest.

Thanks so much

Ashley