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

Serial Number "Sub-Set"


RK

Recommended Posts

Novice FM user in desparate need of slick, reliable solution.

I have Complex Db records each tagged with a single auto-enter / unique serial number. Need to duplicate and alter an individual records for additional work. How can I produce "children" of the record's unique serial number?

Example:

 

58877 (Duplicated twice) / (Total of three 58877 records)

58877-1

58877-2

Thanks very much in advance.

Link to comment
Share on other sites

Hi, RK

 

I would imagine you are understandably loathe to alter the existing ID format in any way. I would agree.

 

Perhaps if you create a number field named, for example, "Children", and attach a script to a duplicate button. The script could, for example, set the "Children" field on the original record to 0 (Zero), create a duplicate record, and set the "Children" field on the duplicate record to "Children + 1". You may want to consider making the script to do an initial search and sort on the record ID number you are duplicating, and having it then go to the last record.

 

All master records that had been duplicated would be easily identified, as they had a "0" (Zero) tag attached. Any search for a master ID number would also call up all the duplicates. You could orchestrate sort capabilities into the button, etc etc. There is also the possibility to create a calculation text field ("This is a duplicated record")that is activated by the "Children" field containing data ...

 

Hmm ... now that I look at it ... all I've really done here is repeat what you said back to you .. Still ... perhaps there's food for thought in there. If you get no other replies, it may set your thinking in a

 

Whisky Wolf

Link to comment
Share on other sites

Hello RK,

I suggest that you adopt a two-part solution:

 

Before you begin, create a self-join relationship (ie one that links the file to itself) called 'SelfJoin' which matches the SerialNumber field to itself. Once that is in place, try the following:

 

1. Since your serial numbers are 'Auto-entry', duplicating a record in the normal way will generate a new serial number. Instead, I suggest that you create a script to duplicate a record and retain the serial of the original. To do this, create a new global text field called 'gTemp_txt' and a new number field called SubSerial_num, then set up your script as follows:

 

Set Field ("gTemp_txt", "SerialNumber"]

Duplicate Record/Request

Set Field (""SerialNumber", "gTemp_txt"]

Exit Record/Request

Set Next Serial Value ["SerialNumber", "GetNextSerialValue(Status(CurrentFileName), "SerialNumber") - 1"]

Set Field ["SubSerial_num", "Case(Count(SelfJoin::SerialNumber) - 1, Count(SelfJoin::SerialNumber) - 1)"]

 

2. Then, to achieve the numbering system you require, create a new calculation field with the formula:

 

SerialNumber & Case(SubSerial_num, "-" & SubSerial_num)

 

and put that on your layouts in place of the existing serial number field.

 

That's it. With the above steps in place, your original serial number field will continue to work behind the scenes. However the calc field which is displayed in its place will show normal serial numbers in all cases except where a record is duplicated using the script described at 1 above, in which case the 'sub-set' serial numbers will be displayed instead.

Link to comment
Share on other sites



×
×
  • Create New...

Important Information

Terms of Use