` Template snippets to derrive FileManger to add NULL values where needed (Bjarne Havnen) - Icetips Article
Icetips - Templates, Tools & Utilities for Clarion Developers

Templates, Tools and Utilities
for Clarion Developers

Icetips Article

Back to article list   Search Articles     Add Comment     Printer friendly     Direct link  

Templates: Template snippets to derrive FileManger to add NULL values where needed
2004-04-01 -- Bjarne Havnen
 
Newsgroups: sv.clarion.drivers > Any chance we can see a snippet of your derived FM that handles this? No problem. It doesn't look very pretty now, been some adjustements and more to come. I will kill the Select Max() type of autoinc. What I do to get this work is to let AutoInc be checked on the key to generate the call The first field in the recordstructure must be the Seed field I never call PrimeAutoInc directly, since I depend on some fields to be NULL, I call primerecord. I add the below template on the files that need it, that is the files where I need to immedialtely know the ID. I will also have to handle the cancelautoinc and set some flags for autoinc done #Extension(AdiEnableSeed,'Enable SEED'),Application,Multi,Description('Seed for '& %AdiFile) #Display('This template requires the AdiSQLFM class') #Prompt('File',File),%AdiFile #Prompt('Max value',Check),%MaxIt #At(%FileManagerCodeSection,%AdiFile,'Init','(File File,ErrorClass EC)') !Self.SqlAutoInc = True #If(Not %MaxIt) Self.SqlAutoInc =1 #Else Self.SqlAutoInc=2 #End #EndAT This is the template I use to set null on some fields. All fields that should be primed with a default value from other file is checked and I can also add some other fields if I like. Note that I change the SuppressClear parameter to avoid NULL being set to 0. #Extension(AdiSetNULL,'SETNULL() on all empty fields before insert'),Application,Multi,Description('SETNULL '& %ADiFile) #Prompt('Select File',File),%AdiFile #Display('Field that have initial value will always be checked') #Button('Select fields to null'),Multi(%AdiFields,%Adifield),Inline #Prompt('Select Field',Field(%Adifile)),%AdiField #EndButton #At(%FileManagerCodeSection,%AdiFile,'PrimeRecord','(Byte SuppressClear = 0),BYTE'),Priority(2500) #Declare(%MyF) #Fix(%File,%AdiFile) If Not SuppressClear #

Today is April 24, 2024, 8:59 pm
This article has been viewed 35110 times.
Google search has resulted in 28 hits on this article since January 25, 2004.



Back to article list   Search Articles   Add Comment   Printer friendly

Login

User Name:

Password: