NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: Poul Jensen on May 16, 2025, 03:11:42 AM

Title: Call a related table update form (SOLVED)
Post by: Poul Jensen on May 16, 2025, 03:11:42 AM
Hi,

From a button on the update form of table A, I would like to call the update form of a related table B.
On the button > Client-Side > Send new value to server, I get the record of the related table B (and verifies with debugview++ that it is the correct record) but I have no luck with calling the related update form.

Have tried various variants of code hacked from table B's browse, but without success.  See code below:

Code: [Select]
    DO OpenFiles
    !Get record of table A
    Access:MobSagH.ClearKey(MSagH:KeyGUID)
    MSagH:GUID =  p_web.GSV('MSagH:GUID')
    NOMEMO(MobSagH)
    IF Access:MobSagH.TryFetch(MSagH:KeyGUID)
        !failed
    ELSE
        !Get record of table B
        Access:MobCustomers.ClearKey(MCus:KeyGUID)
        MCus:GUID =  MSagH:KundeGUID
        NOMEMO(MobCustomers)
        IF Access:MobCustomers.TryFetch(MCus:KeyGUID)
            !failed
        ELSE
            ds_outputdebugstring('RET KUNDEN - **OK**  MSagH:KundeGUID: ' & MSagH:KundeGUID)
            p_web.SSV('MCus:CUSTOMERNO', MCus:CUSTOMERNO)       

            !This doesn't work
            UpdateMobCustomers(p_web,Net:Web:Popup)  !Form Procedure
                   
        END
    END
    DO CloseFiles

What am I missing here?

tia
/Poul
Title: Re: Call a related table update form
Post by: rjolda on May 16, 2025, 10:18:17 AM
Hi Poul,
Are you going to use a Button to call Table B Update?
On the Button Code - "On CLick" - you can call the Update PROCEDURE for Table B here.  You can set any Parameters to pass to Table B on the next line.  Lastly the last check box "Include Action" you can check and set the action to Insert, Change as appropriate.  That is where I would start.
Ron
Title: Re: Call a related table update form
Post by: Poul Jensen on May 17, 2025, 07:25:08 AM
Hi Ron,

Thanks - that got me going.
Had an issue still getting an Record Not Found error when loading form B, until I added this code in the InitForm Routine:

Code: [Select]
p_web.SetValue('MCus:CUSTOMERNO',p_web.GSV('MCus:CUSTOMERNO'))
/Poul