SETNULL on foreign key fields in PrimeFields is lost before the ADD on MS SQL (Reported, not reproduced)

Applies to: posted in the softvelocity.products.c55ee group; ABC browse, MS SQL back end. No version number is named in the thread.

Problem as reported

Code placed by a template in the global PrimeFields embeds ran SETNULL on foreign key fields when they were 0 or blank, and NULL() confirmed they were null. On an insert from a standard ABC browse the ADD still failed with a foreign key constraint violation. The poster read the call order as PrimeRecord, PrimeFields, PrimeAutoInc, SaveBuffer, new auto-increment value, RestoreBuffer, ADD, and suspected RestoreBuffer overwrote the null fields.

What the thread found

  • One reader used SETNULL(PRE.Record) in WindowManager.PrimeFields at priority 1300 and said it set all columns to NULL on insert.
  • A second reader put the code in the PrimeRecord method before the parent call: Clear(My:Record), SuppressClear = TRUE, then SETNULL on the field or the other starting value.
  • A third reader put SETNULL(My:field) in FileManager.PrimeAutoInc before the parent call.
  • The poster said he already did the first one for the key fields only and saw "very strange results", then said he would try PrimeRecord and PrimeAutoInc instead. He did not report back.

Caveats

  • The three readers placed the code in three different methods; no one confirmed which placement cures the lost nulls.
  • The poster's suspicion about RestoreBuffer was never tested in the thread.

Today (2026)

Not reproduced. This entry records a 2003 report. If you have nulled foreign key fields on insert with an ABC browse on a current build, tell us which embed worked and the entry can close.

Sources: Todd W. (Jan 2003, the question), Eric A., Klaus H., Hiroyuki K. (Jan 2003) in softvelocity.products.c55ee.