Hello to all members of the community network.
I have a question and could not find an satisfactory solution to it so far. Maybe you can help me out on this:
We do have a customer who works with batch numbers. Almost every item is managed by batch numbers. So whenever they buy an item of its vendors and book it into the warehouse or produce an item and put it into their warehouse a batch number needs to be generated. In order to handle this by an automatic generation of batch numbers we developed a query (formated search) as follows::
SELECT RTRIM(RTRIM($[$3.0.0])+Right('000000000000000'+RTRIM(CAST(MAX(CAST(Substring(T0.BatchNum,LEN($[$3.0.0])+1,15-LEN($[$3.0.0])) AS int))+1 AS CHAR)),LEN(MAX(Substring(T0.BatchNum,LEN($[$3.0.0])+1,15-LEN($[$3.0.0])))))) FROM OIBT T0 WHERE Left(T0.BatchNum,LEN($[$3.0.0])) = $[$3.0.0]
At first view the query works just fine. But on the long run you will notice that the query will always find the same number and no new number is generated.
IIf you have any further questions - I'll be happy to answer them. If you have an idea on getting the query to work correctly - I would be very very happy to get a good hint!!
Thanks to all of you,