D3D1 Posted February 25, 2022 Posted February 25, 2022 May I ask, I'm making database with ID, DATE and NAME, but I want if I input DATE for example day(2digit),month(2digit)and year(4digit) and I enter it will be automatic in the ID it say year(4digit)month(2digit)day(2digit) and there is 0001 behind day. for example date:25-02-2022 if I enter the ID must be like 20220225-0001 it will be like that and automatically sequentially. sorry if my English is not good. I'm Dedy from Jakarta, Indonesia
comment Posted February 25, 2022 Posted February 25, 2022 8 hours ago, D3D1 said: if I enter the ID must be like 20220225-0001 it will be like that and automatically sequentially. I don't understand this part. If you want sequential ID, then you (as the user) cannot be entering your own. Also, it's not clear what exactly "sequential" means here. Do you want to restart the sequence at the beginning of each day? If so, you are looking at further complication, because Filemaker does not have a built-in mechanism for this. Is your solution hosted on FM Server? 1
D3D1 Posted February 26, 2022 Author Posted February 26, 2022 if I press New Record and fill in the DATE column automatically in a written ID as I give the image. without to fill in ID manually. thank you dedy Untitled.fmp12
Steve Martino Posted February 26, 2022 Posted February 26, 2022 Simple version, maybe this helps.UntitledMod1SM.fmp12 1
comment Posted February 26, 2022 Posted February 26, 2022 (edited) 56 minutes ago, Steve Martino said: Simple version The date part of your calculation does not distinguish between Jan 21 and Dec 1 (for example). The correct expression for a 6-digit YYMMDD result, as indicated in the question, would be: Right ( Year ( date ) ; 2 ) & SerialIncrement ( "00" ; Month ( date ) ) & SerialIncrement ( "00" ; Day ( date ) ) or, if you prefer: SerialIncrement ( "000000" ; 10^4 * Mod ( Year ( date ) ; 100 ) + 10^2 * Month ( date ) + Day ( date ) ) Edited February 26, 2022 by comment 1
Steve Martino Posted February 27, 2022 Posted February 27, 2022 20 hours ago, comment said: The date part of your calculation does not distinguish between Jan 21 and Dec 1 (for example). The correct expression for a 6-digit YYMMDD result, as indicated in the question, would be: Right ( Year ( date ) ; 2 ) & SerialIncrement ( "00" ; Month ( date ) ) & SerialIncrement ( "00" ; Day ( date ) ) or, if you prefer: SerialIncrement ( "000000" ; 10^4 * Mod ( Year ( date ) ; 100 ) + 10^2 * Month ( date ) + Day ( date ) ) Nice! 1
D3D1 Posted March 1, 2022 Author Posted March 1, 2022 what if from 2022 to 2023 but the id of the number 0001 is again like the beginning again, for example the id becomes 230101-0001
comment Posted March 1, 2022 Posted March 1, 2022 Then you will need to reset the serial number field at the beginning of each year: https://help.claris.com/en/pro-help/content/set-next-serial-value.html How you do that depends on whether your file is hosted - but when I asked, you didn't answer.
D3D1 Posted March 1, 2022 Author Posted March 1, 2022 On 2/27/2022 at 1:06 AM, comment said: The date part of your calculation does not distinguish between Jan 21 and Dec 1 (for example). The correct expression for a 6-digit YYMMDD result, as indicated in the question, would be: Right ( Year ( date ) ; 2 ) & SerialIncrement ( "00" ; Month ( date ) ) & SerialIncrement ( "00" ; Day ( date ) ) or, if you prefer: SerialIncrement ( "000000" ; 10^4 * Mod ( Year ( date ) ; 100 ) + 10^2 * Month ( date ) + Day ( date ) ) I will try my best, thank for your help
Recommended Posts
This topic is 1068 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now