NetTalk Central

Author Topic: Refresh Drop Field  (Read 3960 times)

jvillasenor

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Refresh Drop Field
« on: September 04, 2012, 08:14:38 AM »
Hi All

I am new in NetTalk and am converting one of application to web, well Logon startup I'm stuck and use the following:

 Logon:       Field
 Password: Field
 Company: Drop Field

The Logon User is typed and is looking in one Table, this apparently works. DONE!

in this embed we get the User ID, and we ​​use:
  p_web.SetSessionValue ('F1: USER_ID', F1: USER_ID)
and i get the correct ID.

In the Drop I have a filter:
 'VIPR01: ALIAS_ID =' & p_web.GetSessionValue ('F1: USER_ID')

What's going on:

Upon entering the Logon Form, and I click on the Drop of Company are as many names as I have in the table users, why?

After entering the Logon, does not filter or where I have to tell you to do a refresh to Drop?

Many thxs

JM Villasenor
Cancun, Mexico

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Refresh Drop Field
« Reply #1 on: September 04, 2012, 03:25:32 PM »
> Upon entering the Logon Form, and I click on the Drop of Company are as many names as I have in the table users, why?

I'm not sure why, but if the filter fails it returns all records. I test all my filters in code for that very reason. So I add something like this in embed code:

If p_web.GetSessionValue ('F1: USER_ID') = 0
  loc:wasfilter = '1=2'
Else
  loc:wasfilter = 'VIPR01: ALIAS_ID =' & p_web.GetSessionValue ('F1: USER_ID')
End

jvillasenor

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: Refresh Drop Field
« Reply #2 on: September 04, 2012, 05:06:09 PM »
In which embed, i put the initial Filter in :
FIRMA_ALIAS = (Compoanies related)
Value Routine
  L:FILTER = ''VIPR01:ALIAS_ID =0'

in the start works fine, but when i get the User ID where i put the other embed.


kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Refresh Drop Field
« Reply #3 on: September 04, 2012, 06:49:48 PM »
I usually just stick something like 'xxx' in the template filter  and then search for this in embed code and then pick the best embed point from there.

Pauly

  • Newbie
  • *
  • Posts: 26
    • View Profile
    • Email
Re: Refresh Drop Field
« Reply #4 on: September 05, 2012, 02:42:41 AM »
HI,
Should there be a space in between 'F1:'  and 'USER_ID'
All through your examples there is, and surely that would cause unpredictable behaviour?

Pauly

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Refresh Drop Field
« Reply #5 on: September 05, 2012, 03:50:13 AM »
as long as it matched the place he set it, it will be ok.

ie - The space itself is not a problem. If the SessionValue name is not the same of course then there will be a problem.

cheers
Bruce


jvillasenor

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Solution: Refresh Drop Field
« Reply #6 on: September 05, 2012, 08:36:42 AM »
Hi All,

In this moment works as i want, i do the following:

Create a Local Variable (CSTRING 255) to handle the Drop Filter
In the Drop Field filter i put this local variable in this case L:FILTER

In the Drop Field -> 4 Valur Routine (5000) i put the following Embed
!----Drop Filter
IF p_web.GetSessionValue ('F1:USER_ID') = 0
   L:FILTER = 'VIPR01:ALIAS_ID=0'
 ELSE
   L:FILTER = 'VIPR01:ALIAS_ID='&p_web.GetSessionValue ('F1:USER_ID')
END

In the Logon Filed -> 3 ValidateValue Routine (5000)
Here i put a code to check our users then
DO refresh::DROP_FIELD

Works!!!


Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Refresh Drop Field
« Reply #7 on: September 05, 2012, 10:53:03 PM »
Hi JM,

cool - glad you got it working. If you wanted to do the same thong without the local variable you can use the Choose statement.

Filter:
Choose( p_web.GetSessionValue ('F1:USER_ID') = 0, 'VIPR01:ALIAS_ID=0', 'VIPR01:ALIAS_ID='&p_web.GetSessionValue ('F1:USER_ID'))