I don’t see anything that jumps out at me, but. How about tracing to see what is happening?
Also if this is a multi user db. There could be failures You could also do this c_longint($FolderNo_L) c_text($Prefix) $Prefix:=[Repertoire]Folder prefix Begin sql select MAX([Repertoire].[Folder number]). primary key of that table from [Repertoire] where [Repertoire].[Folder prefix] = :$Prefix into :$FolderNo_L, :$Key end sql if ($Key = key of my record) else end if Hope this helps ------------------------------------------------------------------------------------------------ Chuck Miller Voice: (617) 739-0306 Informed Solutions, Inc. Fax: (617) 232-1064 mailto:cjmiller<AT SIGN>informed-solutions.com Brookline, MA 02446 USA Registered 4D Developer Providers of 4D and Sybase connectivity http://www.informed-solutions.com ------------------------------------------------------------------------------------------------ This message and any attached documents contain information which may be confidential, subject to privilege or exempt from disclosure under applicable law. These materials are intended only for the use of the intended recipient. If you are not the intended recipient of this transmission, you are hereby notified that any distribution, disclosure, printing, copying, storage, modification or the taking of any action in reliance upon this transmission is strictly prohibited. Delivery of this message to any person other than the intended recipient shall not compromise or waive such confidentiality, privilege or exemption from disclosure as to this communication. > On Jul 22, 2020, at 4:28 PM, Stephane Potvin via 4D_Tech > <[email protected]> wrote: > > 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. ********************************************************************** 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] **********************************************************************

