Good day all,
I have a database for organizing my printed music collection.
I use a folder numbering system to do so, using this format: Letter-number
i.e. A-25, A-26, B-17, B-18, etc.
I have one field for the letter and one field for the number.
To make it easy, I use the method below to automatically fill the number when I
enter a letter.
If I enter the letter A, the number will automatically fill the number with 27
if the last one in existence was 26 for the letter A.
It behaves fine for single letters and combinations: AB, ED, etc.
Everything works perfectly well except when I enter the letters CH.
When I do the number field gets the value 207119, and up, whereas it should
currently be CH-271
I need your help figuring our why it behaves this way only for those letters.
Thank you in advance for your help.
Stephane Potvin
C_TEXT($prefix)
C_LONGINT($recordNumber;$folderNumerical)
$prefix:=[Repertoire]Folder prefix
$recordNumber:=Record number([Repertoire])
$folderNumerical:=0
PUSH RECORD([Repertoire])
CUT NAMED SELECTION([Repertoire];"Pieces_TempSelection")
QUERY([Repertoire];[Repertoire]Folder prefix=[Repertoire]Folder prefix)
ORDER BY([Repertoire];[Repertoire]Folder number;<) //Descending sort loads the
record with highest value
If (Record number([Repertoire])#$recordNumber) //The record with highest value
is not the original one
$folderNumerical:=[Repertoire]Folder number+1
End if
USE NAMED SELECTION("Pieces_TempSelection") //Restore the original selection
POP RECORD([Repertoire]) //Restore the original record
If ($folderNumerical#0) //Otherwise, no need to assign value
[Repertoire]Folder number:=$folderNumerical
End if
**********************************************************************
4D Internet Users Group (4D iNUG)
New Forum: https://discuss.4D.com
Archive: http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:[email protected]
**********************************************************************