NetTalk Central
		NetTalk Web Server => Web Server - Ask For Help => Topic started by: terryd on January 23, 2012, 10:28:54 PM
		
			
			- 
				Windows7Ultimate 64bit Clarion63_9056 NT545
 When I INSERT a new Parent
 In my parent form I have a selection from a product list
 On the same form I have a browse of insured items
 Once I have selected a product I select insert on the insured item browse
 Based on the productID selected in the parent I want to hide certain fields in the insured items form.
 The problem seems to be that at this point the parent record has not been written to the table so if I prime the child with INS:ProductID = APP:ProductID the value is zero
 I tried this
 ACCESS:Application.Open()
 ACCESS:Application.UseFile()
 APP:ApplicationID = INS:ApplicationID
 ACCESS:Application.FETCH(APP:PK_ApplicationID)
 INS:ProductID = APP:ProductID
 p_web.SetSessionValue('INS:ProductID',INS:ProductID)
 ACCESS:Application.Close()
 in preinsert end with no luck (because there was nothing written to the table yet)
 I then tried adding
 adding
 p_web.SSV('NewProductCode',p_web.GSV('APP:ProductID'))
 p_web._trace('application_form newpeoductcodevalue ' & p_web.gsv('NewProductCode'))
 
 to the server code of the parent productid selection but the trace value is blank
 had this worked I would then have put this code in the preinsert end embed of the child
 
 IF p_web.GSV('INS:ProductID') = 0
 INS:ProductID = p_web.GSV('NewProductCode')
 p_web.SSV('INS:ProductID',INS:ProductID)
 p_web._trace('insureditem_form productid cannot be zero ' & p_web.GSV('INS:ProductCode'))
 END
 
 What should I try to have the productID available to me within the child form?
- 
				Hi Terry,
 
 Maybe you should use "send new value to the server" and then some server side code to keep the data you need in a sessionvar.
 
 Cheers,
 Rene
- 
				If the parent ID is being auto-numbered, then you should do it in PostInsert, not PreInsert or ValidateRecord.
 
 cheers
 Bruce
- 
				Hi bruce
 I am getting the parentID, what I need is the productID which is selected while the parent is still in insert mode before saving.
- 
				That should be in the Session Value of that field.
 Unless you're overwriting that session value in your code.
 
 >> I prime the child with INS:ProductID = APP:ProductID
 
 rather prime the child with INS:ProductID = p_web.GSV('APP:ProductID')