May 24, 200421 yr Hello all, I would appreciate if anybody can help me. I am using FM7 and FM7 Preview with two files. One of this files is the customers file (Customers) and the other one is the payments file (Payments), with different tables in this Payments file In order to insert a new payment information in the payments file, based on the Customers file, I have the following: 1) The table1::Payment_ID field is a number field , with auto enter serial number in the payments file 2) I use a calculation field with the GetNextSerialValue ("payments.fp7" ; "table1::Payment_ID") in the Customers file in order to get the appropriate serial number. 3) However I get a blank field as a result. I have tried to use: GetNextSerialValue ("fmnet:/ipaddressofFMServer/payments.fp7;"table1::Payment_ID") and GetNextSerialValue ("file:payments.fp7;"table1::Payment_ID") and did not succeed. This function worked well in my FM6 solution. Anyone can help me? Thanks Alex
May 24, 200421 yr Hi Alex, I'm not quite following what you're doing but I think you're going about it the wrong way. The GetNextSerial is usually only used in an upgrade process, not in a record creating process. Even if you capture that next serial number, there is no guarantee it will still be available when you need to create the record in that file. Wim
May 24, 200421 yr Author Hi Wim, In FM6 it worked well. But in FM7 it does not work if you try to get in a script in another file (Customers) the next serial number of Payments file (Payments_ID) in order to create a new record in this Payments file in this same script of Customers file. I got a solution that I will post here. If possible, please comment. Thanks Alex Hi ! I have found a turn-around for the problem that I was facing. I used a global field (global_last_serial_ID)in the Payments file, with an auto-enter option that has the last value of the Payment_ID in this file/table. Then, with any relationship (there are some) between the Customers file and the Payments file I can get the value of the last Payment_ID, through this global field. So, in the Customers file I can have: g_Last_Serial_ID = anyrelationship::global_last_serialID and then, using the Set Next Serial Value Script Step in the Customers File: Set Next Serial Value (table1::Payment_ID; g_last_Serial_ID + 1) With this solution I made the turn-around. However , I don
May 25, 200421 yr I don't follow what you're doing exactly but I have a feeling that what you're doing is dangerous from a relational integrity point of view. If you're in the customer file and need to create a new payment for that customer you can do that in a number of ways but you don't need to capture the NextSerialNumber of the paymetns file *before* creating a record there. If you do and use that number you have no way of knowing if another user created a record in the payments file - and use that next serial # - before you do... HTH Wim
May 25, 200421 yr Author Hi Wim, I realized that if two people can get the same Next Serial Value at the same time, however the fill in of the record is not made by typing , but it is made to information in a script. But maybe, some miliseconds can lead me to problems. What I want to do is the following. 1) I need this Payments_ID (in a sequential order) in the payments file, because it will be my reference for a later check if some customer paid or not an installment. This check is based on an electronic (.txt) file that is processed by FM7. In this file, each customer/payment is related to this ID. 2) Thes Payments_IDs are generated by the customers file, where I get basic information and calculation to generate the proper values and other info. 3) You can ask me if I could not generate this new record working in the Payments file itself, with a script, not in the Customers file, with a script (as I already do). For my data structure it will be dificult, once I will share this payments file with other applications and it is a file that grows at a rate of 10,000 records a month (payments). I don
May 25, 200421 yr "You can ask me if I could not generate this new record working in the Payments file itself, with a script, not in the Customers file, with a script (as I already do). For my data structure it will be difficult." What difficulty to you imagine? There just isn't a problem here. One of the things I commonly do in this circumstance is use a global in the new-record script. This allows you to capture the ID of the new record. Go to layout based on Payments TO New Record Set field [gPaymentID, PaymentID] Go to original layout etc. Since globals don't require a relationship, you can use the captured value in gPaymentID in your script. Since it is a global, it does not interfere with other users who are creating/manipulating records.
Create an account or sign in to comment