NetTalk Central

Author Topic: How to know if the call to a form was an insert, update or delete?  (Read 4036 times)

asigala

  • Newbie
  • *
  • Posts: 3
  • Alexis Sigala
    • MSN Messenger - alexis.sigala@interseccion.com.mx
    • View Profile
    • Interseccion Software Developers
    • Email
Hi everybody.

Mi question is how to detect what was the globalrequest to a form . is there any way to know it ?

What i want to do is condition some fields inside the form, if the form was called to update, i want to set them to read only.

Thanks in advance
Alexis Sigala
Interseccion Software Developers

Matthew51

  • Full Member
  • ***
  • Posts: 152
    • View Profile
    • Email
Re: How to know if the call to a form was an insert, update or delete?
« Reply #1 on: August 12, 2009, 10:55:28 AM »
I think the easiest way is by checking the Change_btn value.

First check:
Code: [Select]
if ~p_web.IfExistsValue('Change_btn')
If the value doesn't exists then the form follows the default action (if you set it up).  This shouldn't happen unless you intend it to.
Then it's just a case statement:
Code: [Select]
case p_web.getvalue('Change_btn')
of 'Insert'
  code
of 'Delete'
  code
of 'Copy'
  code
of 'Update'
 code
end
Contractor with 10+ years of NetTalk experience looking for work.
www.linkedin.com/in/matthew-leavitt
BisWare.ca
Check out my free EasyTime Template

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: How to know if the call to a form was an insert, update or delete?
« Reply #2 on: August 12, 2009, 11:06:02 PM »
There's an easier way.

the loc:act variable is primed for you in the form. So you can test this to see the current action.
= one of
net:InsertRecord
net:ChangeRecord
net:CopyRecord
net:DeleteRecord

Cheers
Bruce

asigala

  • Newbie
  • *
  • Posts: 3
  • Alexis Sigala
    • MSN Messenger - alexis.sigala@interseccion.com.mx
    • View Profile
    • Interseccion Software Developers
    • Email
Re: How to know if the call to a form was an insert, update or delete?
« Reply #3 on: August 17, 2009, 04:04:57 PM »
Many Thanks Mattew, and Bruce.

I founded this in a topic......

I think this should work and is a complement to Bruce sugestion.

I put this in the generateform star embed.

    if p_web.GetSessionValue('UpdatePedido2_CurrentAction') = ChangeRecord THEN
        loc:Truper = 1 ! The variable to set the condition
    else
        loc:Truper = 0
    end

Cheers

Alexis



Alexis Sigala
Interseccion Software Developers