create record(PackingSlip)
[PackingSlip]TicketID:=num(f_ticketid)
[PackingSlip]Ship_Via:=$f_ship_via
save record(PackingSlip)

The variables that start with an 'f' is the data from the form.

First off, don't use variables like that, it is _very_ old school and not recommended. You are much better off using _form{"f_ship_via"} and _form{"f_ticketid"}.

I'll assume you typed the code above and didn't copy and paste, otherwise the code would not run very successfully...


If the form
is used, a dialog box appears on the 4D Web server client stating
'Attempting to write non-unqiue data to a table with a unique field'.

Can anyone give me some pointers on how to identify the unique field and
how I should populate it?

If you need to check for uniqueness, you have to query the unique field _before_ trying to create a new record, something like this:

query([PackingSlip]; [PackingSlip]TicketID = _form{"f_ticketid"})

if (records in selection([PackingSlip]) # 0)
   // tell the user it isn't unique
else
   read write([PackingSlip])
   create record([PackingSlip])
   [PackingSlip]TicketID := num(_form{"f_ticketid"})
   [PackingSlip]Ship_Via := _form{"f_ship_via"}
   save record([PackingSlip])
   unload record([PackingSlip])
   read only([PackingSlip])
end if

Regards,

   Aparajita
   www.aparajitaworld.com

   "If you dare to fail, you are bound to succeed."
   - Sri Chinmoy   |   www.srichinmoylibrary.com


_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Reply via email to