NetTalk Central

Author Topic: BrowseToAnotherForm - How to get selected record field value?  (Read 3387 times)

Manuel

  • Newbie
  • *
  • Posts: 41
    • View Profile
BrowseToAnotherForm - How to get selected record field value?
« on: October 17, 2012, 10:10:37 AM »
Hi,

Have View botton for each record of browse.

Key field of form file is field of browse file but no the key of the browse file. (diferece from example 23) 

I supouse have to setSessionValue with browse field value that is key of form file. I cant´t find the browse embed and sentece to get value.

Thank you.
Manuel   

Manuel

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: BrowseToAnotherForm - How to get selected record field value?
« Reply #1 on: October 17, 2012, 10:16:55 AM »
NT 6.45

Regards
Manuel

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11251
    • View Profile
Re: BrowseToAnotherForm - How to get selected record field value?
« Reply #2 on: October 17, 2012, 09:48:46 PM »
Hi Manual,

>> Key field of form file is field of browse file but no the key of the browse file.

to work "automatically" the browse and form need to be using the same Unique ID key. (Bear in mind the key is used for ID, not for the sort order of the browse. You can sort the browse anyway you like, it's not related to the ID key at all.)

If you can't use the same key, then you need to "prime" the record on the form when you start it.
I would say the PreUpdate routine embed point is likely the right one to use (although I haven't tried it myself).
at this point you have the fields from the Browse Id Key in the session queue. You would need to open the table, read the record, and then copy the "other fields" (ie the one's for the form key) to the Session queue.

cheers
Bruce

Manuel

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: BrowseToAnotherForm - How to get selected record field value?
« Reply #3 on: October 18, 2012, 11:30:49 AM »
Bruce,

Tried in form PreUpdate and InitForm

 p_web.SetValue('car:precampo',p_web.GetSessionValue('CAR:precampo'))
 p_web.SetValue('car:carpeta',p_web.GetSessionValue('CAR:carpeta'))

and

  p_web.SetValue('car:precampo',p_web.RestoreValue('CAR:precampo'))
 p_web.SetValue('CAR:carpeta',p_web.RestoreValue('CAR:carpeta'))

Browse key has two fields, and get 0

It´s my first NTWS app and I´m confused about GetSV and RestoreSV.
  
------

Is it possible in browse get selected record field(no key) to setSessionValue with.

Tried at Value::routine for ButtonView

p_web.SetSessionValue('CAR:nroopadu',CAR:nroopadu)  (CAR:nroopadu it´s browse record field, no key)
 !message(CAR:nroopadu & '6')

Get the field value from the page last row.

Tried at SelSelection, SetFormAction, User did something in browser, and can´t get field value

Thanks
Manuel

    

It´s my first NTWS app and I am cofused about GetSV and RestoreSV


Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11251
    • View Profile
Re: BrowseToAnotherForm - How to get selected record field value?
« Reply #4 on: October 18, 2012, 09:43:53 PM »
Hi Manuel,

>> It´s my first NTWS app

ok - let me be clear. Set the browse and the form to use the same unique key. Then you won't have to mess around with embed code at all.

>> and I am confused about GetSV and RestoreSV

GetSessionValue is the opposite of SetSessionValue. These you will use all the time to store, and get variables.
StoreValue is also used a fair bit, to move parameters into the session queue (if they exist).

RestoreSessionValue is not something you will almost every use in code.

cheers
Bruce