Meetloaf Posted October 25, 2006 Posted October 25, 2006 Hello, I have what I think is a simple question. I am creating a databse that automates the creation of scholarship awards that often come from more than one account code. I currently have a series of nested "if" statements to handle the creation of up to 4 fundings, with variables such as the following: $account1, $account2, $account3, $account4; $letterRequired1, etc., etc. As you can see, I am doing the same thing over and over for multiple scholarships. I am effectively doing a loop w/o using the loop capabilities. I think I can put the format of my script into a loop by using repeating variables. My problem is that I do not fully understand how to store values into repeating variables/fields, nor do I know how to retrieve them. Any help? Thanks in advance.
Ender Posted October 25, 2006 Posted October 25, 2006 You would use the Repetition section at the bottom of the Set Variable [] dialog to set a repetition, and use the bracket notation to retrieve a particular repetition (i.e. $value[n] ). But it's not clear why it would be desirable to store all those things in a temporary storage location in the first place. Maybe you can shed some light on the source and destination of all that data that makes this data juggling necessary.
Meetloaf Posted October 25, 2006 Author Posted October 25, 2006 (edited) Three things: First, I want to thank you for questioning my Db! I was typing out a response, when I realized that I had my tables set up incorrectly. I am now going to restructure b/c I need a fourth table to accommodate a M:N relationship I neglected to account for. Here's what I have come up with (it is very much like an invoicing system that has Customer, Orders, Order-Inventory, and Inventory tables): Applicants Table (PK - StudentID) Awards Tables (PK - AwardID, FK - StudentID) Award Allocation Table (Concatenated Key - Student ID/Account #) Scholarship Accounts Table (PK - Account #) Second, the reason I want to store these variables temporarily is b/c I want the script gather all the information needed to create multiple records all at once (instead of having the user create each record individually). IT will gather the info and create the records with the data collected, and the user will think that they just created one "Award", when in reality they've created a record in the Awards table and record(s) in the Award Allocation table (however many accounts the scholarship will be funded with). If you any any suggestions I am more than open to them. Third, when setting repeating variables, if I put "3" in the prompt that asks for repetition, is that referring to WHICH repetition (indicating I am storing the THIRD repetition), or the AMOUNT of repetitions I want to allow (MAX of 3 repetitions)? Thanks! Edited October 25, 2006 by Guest
Ender Posted October 25, 2006 Posted October 25, 2006 I don't quite see why you're automating a process to populate records with all that data. Presumably the data is already in the system somewhere, so why not relate to it? It shouldn't take too much work to just populate the join tables. The Repetition section of the Set Variable[] step is the repetition you wish to set. There's no need to predefine the range of repetions for variables.
comment Posted October 26, 2006 Posted October 26, 2006 I am not following the process too closely either, but it seems like you could just import the records you need, then set the foreign key field to the current parent (AwardID?).
Meetloaf Posted October 27, 2006 Author Posted October 27, 2006 Sorry for the confusion, the information that will be gathered is all information that will be input upon creation of a new record in the Awards and award allocation tables (other than the scholarship and applicant info). It will be information like: - Scholarship Amount for each selected Scholarship Account - How much of each amount should be allocated to each semester? - Is a scholarship letter required? - Which Scholarship accounts should be included in the notification letter? Now, having said that, both of you talked about info that already existed, perhaps you are assuming that I am more database savvy than I really am =) What did you think was happening here...perhaps there is something that I could be doing better. Thanks for your help.
bruceR Posted October 30, 2006 Posted October 30, 2006 It would probably be better if you would post your entire script, or an example file. You aren't being very clear and you aren't providing enough information for anybody to help you.
Meetloaf Posted November 1, 2006 Author Posted November 1, 2006 Sorry about all of the confusion. The problem is that I am rebuilding the database b/c of my cardinality problems. When I get it database rebuilt and start working on the script again, I will let you know if I have any further problems. Thanks for your help, you really have helped me improve my solution.
Recommended Posts
This topic is 6599 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