Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Record Numbers - Another Great


ATMANdu

Recommended Posts

I am trying to set up my database to set a Record number so I have a common referance to use for all of my records. I could use the built-in "Serial Number" option when defining the auto-enter sequence but it is to limited and if, for some reason, the last record had to be deleted then I would have to keep reseting the "Serial Number" value back a number so it doesn't screw up the whole works down the road.

 

Now resetting the "Serial Number" value is not that hard, but when you have to trust the database with your employees who are not trained(or for that matter, allowed) to modify fields it can become a problem. Hence the automation wink.gif

 

I am thinking a calculation that could read the value of the "RecordNo" field in the previous recordand add 1.

 

This was suggested in an earlier post but from what DBasine suggests, it looks as though it is only meant to work when a new record is created through a scripted button, and I am not quite sure if it will work for importing(which is my main form of entering records).

 

Posted by DBasine

Do you have a button for your users to make a new record? Then you can stick a script to this button:

 

you also need a global field, as number: e.g. "_globalnr"

 

new record/request

Set Field [ _globalnr, 0 ]

Loop

Insert Calculated Result [ RecordNumber, Status(CurrentRecordCount)-(200+_globalnr) ] [ Select entire contents ]

Exit Record/Request

Exit Loop If [ Status(CurrentError) >

Set Field [ _globalnr, _globalnr + 1 ]

End Loop

 

With this script, it checks the last 200 records to see if there are no gaps in the numbering. If yes, it will give the new record the missing number.

Is that what you need?

If it will work, or if something needs to be tweeked, or if there is a different script altogether for this, let me know.

 

Thanks alot for the help!

Link to comment
Share on other sites

Hello ATMANdu,

I'm back again (had to drive home first)

In that case, you have to import via a script:

import records [ Restore import order, No dialog ]

Go to Record/Request/Page [ First ]

Set Field [ _globalnr, Status(CurrentRecordCount) - Status(CurrentFoundCount) + 1 ]

Loop

Set Field [ Recordnumber, _globalnr ]

Set Field [ _globalnr, _globalnr + 1 ]

Go to Record/Request/Page [ Next, Exit after last ]

End Loop

Link to comment
Share on other sites

I have also used the import script and it works fine but is there any way I can start the record count from zero? At the moment it starts at one.
Well, then you set the globalnr to 0 in the script:

 

import records [ Restore import order, No dialog ]

Go to Record/Request/Page [ First ]

Set Field [ _globalnr, 0 ]

Loop

Set Field [ Recordnumber, _globalnr ]

Set Field [ _globalnr, _globalnr + 1 ]

Go to Record/Request/Page [ Next, Exit after last ]

End Loop

 

glad to help!

Link to comment
Share on other sites



×
×
  • Create New...

Important Information

Terms of Use