How to force load Initial Value from Dictionary when Insert in Form

I’m starting a FORM, and I indicate from the reading, if it’s going to be an INSERT, and in that, I want it to load the INITIAL VALUE from the Dictionary. How do I force it to read the initial values?

The ABC templates do that defaulting from within a browse, not a form. If you don’t have a browse, sometimes it’s simplest to create a small SOURCE procedure to mimic the stuff that the browse does. Then, when the FORM gets called, it gets everything it expects - as if it came from a browse. It’s been a long time since I’ve done ABC, but the source procedure could be something like:


CLEAR(My:Record)

IF NOT  Access:MyTable.PrimeAutoInc()
  GlobalRequest = InsertRecord
  MyForm
  IF GlobalResponse = RequestCompleted
  MyFormWasSaved = TRUE
  END
END

Like Jeff said, but PrimeRecord, not PrimeAutoInc (PrimeRecord will call PrimeAutoInc if required). And you don’t normally care about the GlobalResponse after the form is completed.

1 Like

Access:.PrimeFields() is the actual method that populates the defaults. PrimeRecord calls PrimeFields.
You can always add a call to FM PrimeFields from the window manager PrimeFields method.

if self.Request = InsertRecord
  self.Primary.ME.PrimeFields()
end
3 Likes