Newbies TBWray06 Posted February 8, 2014 Newbies Posted February 8, 2014 Hi, everybody. I'm trying to create a calendar-based survey tool, where users are presented with a month-view calendar layout of the past 30 days (starting from yesterday) and click on each day to answer questions about their behavior on each day. I've (rather brutishly) accomplished the calendar piece by creating a "home" layout that has the calendar view, which is comprised of a grid of auto-calculated date fields. The table with these fields is related to a table of responses (calendar---<responses) with fields for each question asked. When a user clicks on a valid field from the calendar "home" layout, it takes them to a "responses" layout, where they answer the questions for that day. What I'm ultimately hoping it'll produce a dataset that looks something like this: __ID day (or date) numdrinks druguse 1 1 2 0 1 2 0 1 1 3 5 . 1 4 0 0 2 1 0 1 2 2 0 1 So, my first problem: When users click on each day, I was going to use a script to navigate to the "responses" layout, create a new record, set the "day" field in the responses table to the value of whatever field was clicked in the calendar table, and proceed through the questions. But, I can't get the "day" field to set correctly with such a script, I'm guessing due to some problem with the way I have my tables related. Should they be related in some other way? Is there another way you'd recommend accomplishing this? Second problem: I'm also hoping that, as users answer all of the questions asked of them for each day, the corresponding day field in the calendar "home" layout can be conditionally formatted to turn green or something if they provided valid answers to all questions for that day, or turn red if they provided invalid answers to questions for that day. Any thoughts about how to accomplish that? I've attached my work in-progress...please excuse the mess. But, any advice/thoughts are more than welcome! Thank you, in advance. msmsextlfb.zip
eos Posted February 8, 2014 Posted February 8, 2014 Leaving aside the calendar aspect of your project for the moment: you'll be having a hard time working with your surveys if you use a (great) number of (similar) fields for the surveys; you should instead use tables and records – which can a ) grow to any number, are b ) much easier to evaluate, and c) make it easy to add new questions. Here is a link to a thread on this forum; http://fmforums.com/forum/topic/49072-surveys-and-relationships/ I suggest you get this sorted out; after that, adding the calendar functionality will be comparatively easy.
doughemi Posted February 8, 2014 Posted February 8, 2014 See if this helps. Note the added TO of responses and the modified calendar button script. In order to use just one script for all buttons, you need to set a script parameter. This is done when you select the script to be executed by the button, and I only set up a button for the week6sun field. The conditional formatting for that field to turn it green is set up as well. With the validation settings you have for the responses fields, there is no way to ever get the calendar day to show up red (you can't leave the responses layout without setting all the fields). Note that the responses table requires a ClientID field, and that every table should have an auto entered ID field. A couple of other observations: • You don't need int() in the day definitions other than endSaturday. Dates are by definition integers. • Fields named Something1, Something2, etc are not a Good Thing. You should consider making these child tables instead. msmsextlfb_dh.fp7.zip
Newbies TBWray06 Posted February 9, 2014 Author Newbies Posted February 9, 2014 YES, that helped immensely! Now that I think about it, it's sort of unnecessary to have the days turn red anyway, since the most important part of having a validation is just to give users some idea that they're "making progress" or doing things correctly. Anyway, I've added the script parameters, scripts, and the validation you suggested to all buttons, and re-structured my data to use tables instead of extra fields...and it works great! I can't thank you enough for your help with this!
comment Posted February 10, 2014 Posted February 10, 2014 You should look at: http://fmforums.com/forum/topic/42617-basic-monthly-calendar-april-06/?p=200289 for an example of how to create a calendar display with a single repeating calculation field.
Recommended Posts
This topic is 4000 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