Himitsu Posted January 5, 2005 Posted January 5, 2005 I am using Matt's calender that he used on that article about scheduling. And it is designed with mainly only two fields and one script. The script just has a set field function and a parameter to add the day you click on. I was wondering if anyone would know how to add to that so I could make diffenent buttons that would tell it to add that date to a different field rather than the one set in the actual script? here is the setfield function in the script: Let( [ md1 = Date ( Month ( Calendar_Tool::caltool_date ) ; 1 ; Year ( Calendar_Tool::caltool_date ) ); d0 = md1 - Mod ( md1 ; 7 ) - 1; n = Get ( ScriptParameter ) ]; d0 + n I would like to somehow keep it to one script just add maybe a second script that could get the field parameter. Any ideas?
transpower Posted January 6, 2005 Posted January 6, 2005 Make a compound script parameter which would contain the field name and the date. Parse the parameter to get the two values.
Himitsu Posted January 6, 2005 Author Posted January 6, 2005 I am too new at this. I have a hard time thinking how to rewrite this. I know it won't work as is. The example I have earlier, is the calculation for the set field function. So it contains a field already. This script is located on 48 boxes turned into butons that lay under one field, that repeats 48 times. Each box contains the parameter for that repeat, getting the date then putting it in the field that is preset in the calcultion. So I can think that I need a script that contains the field I want to set. That script would invoke the calender script that would contain the parameter of the date it needs to put into the field. So in that calculation up top, would I just take the field that is set already, so not specify a field but run a calculation? The other script would contain the field then the next line in the script would run the script up top?
Himitsu Posted January 8, 2005 Author Posted January 8, 2005 Transpower, I can't really understand a compound script parameter... you mean, in the parameter area, just put the field name in it? I can't really pass any date to it due to the fact that the calendar is using the script parameter to find the date. So the field is repeating 42 times in 6 rows. below it is a button that runs that set field script with the parameter being the number that the repetition it is under. So clicking of the box 16, has the parameter get field value at accurance 16 of that field rep. So it would see 2/16/2005 and box 15 would be 2/15/2005, ect... I have been plugin away at it for almost two days now... and nothing! I though about removing the specify field and from the main script, just leaving the calculation. Then making a seperate script that did a few things, but mainly, go to field then run the script that will set the date. But that didn't work... any ideas?
comment Posted January 8, 2005 Posted January 8, 2005 Why don't you make the script parameter equal to the repetition number, e.g. box 16 has the script parameter of 16. Then: n = GetRepetition ( yourTable::yourRepeatingField ; Get ( ScriptParameter ) ) Or something along this line - I may not fully understand the whole setup.
Himitsu Posted January 8, 2005 Author Posted January 8, 2005 comment, that is what it is set to. what I am trying to do is keep a single layout with the calendar that uses the parameter to get the repetition. Then I just want to make a simple script that I can modify for each field that I need dates for. Such as, birthdays, invoice paid dates, join date, ect... so my staff can just click on a button next to the field, the calendar will popup in another small window, and you can click on the date, it will pass the value the calendar script got and put it in the field that the button is set to. Does that make sense?
comment Posted January 8, 2005 Posted January 8, 2005 Oh, I think I see now - you want to Set Field, and you want the script parameter to say WHICH field to set. I don't think you can do that. Either make a separate script for each datefield that may be filled from the calendar, or look here for a workaround.
Himitsu Posted January 9, 2005 Author Posted January 9, 2005 I attached the file, most of the buttons don't link up. I stripped it down just to show the calendar. triallessonCopy.zip
comment Posted January 9, 2005 Posted January 9, 2005 Try this (the top row buttons work). triallessonCopy.fp7.zip
Himitsu Posted January 9, 2005 Author Posted January 9, 2005 comment.... why didn't I think of that! just have them set that global then set the script to get that value.... woo... that makes a lot of sense! Thanks a ton.
comment Posted January 9, 2005 Posted January 9, 2005 You still have a problem there. When you click on a "grey day" (one that is not in the current month), you get incorrect result. There's no reason to take a date apart and then try to assemble it back again. It is much easier to work with date fields and calculations resulting in date. Translation to text should be only for display - if you want to use color and/or style.
Himitsu Posted January 9, 2005 Author Posted January 9, 2005 comment, I noticed that on the calculation you have put in. The calculation that Matt Patrowsky has on that button, doesn't have that problem. Hmm, maybe it does have something to do with, not breaking the date, but building it from numbers. Then what ever field I put it in to, whether it is a date field or a text field. That is just my usumption.
comment Posted January 9, 2005 Posted January 9, 2005 It happens because the repeating field is text, and it doesn't have a clue which month it belongs to. If the field were a date, then gRegister could take the date directly from there, instead of trying to assemble it from bits and pieces. I don't know how Matt Petrowsky does it (can I download his example anywhere?), and I'd be very careful going against the master, but I would have 2 repeating fields: one that calculates the dates as dates - and the button script sets the gRegister from it; the other is simply Day (firstRepeatingField), set to text, and formatted to your liking. This second field is not part of the "engine" - it is only for display.
Himitsu Posted January 11, 2005 Author Posted January 11, 2005 comment, that whole calculation was his. I only added a parameter. That was it.
comment Posted January 11, 2005 Posted January 11, 2005 I am sorry, but I still don't understand: what is "that whole calculation"? Can you quote his calculation/s, unmodified, or point me to a downloadable file?
Himitsu Posted January 11, 2005 Author Posted January 11, 2005 I am sorry, but I still don't understand: what is "that whole calculation"? Can you quote his calculation/s, unmodified, or point me to a downloadable file? Let( [ md1 = Date ( Month ( Calendar_Tool::caltool_date ) ; 1 ; Year ( Calendar_Tool::caltool_date ) ); d0 = md1 - Mod ( md1 ; 7 ) - 1; n = Get ( ScriptParameter ) ]; d0 + n This is the set field calculation. Then just specify the field you want to set. That is all there was. The article and files are here: http://www.filemakermagazine.com/modules...r=0&thold=0
comment Posted January 11, 2005 Posted January 11, 2005 If you look at your calculation, you will see that the date md1 has the Month and the Year of caltool_date. If ScriptParameter transmits the position of the selected box on the grid, then this simply cannot work: In the month of May 2005, the first position is Sunday, May 1. But in the month of January 2005, the same position is December 26 - the previous month, in the previous year! Earlier you said: "The calculation that Matt Patrowsky has on that button, doesn't have that problem." So I'd be very curious to see it. Unfortunately, the link you provided requires a subscription that I don't have.
Recommended Posts
This topic is 7259 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