New topic: 

Multiple index array help.

<http://forums.realsoftware.com/viewtopic.php?t=34406>

         Page 1 of 1
   [ 5 posts ]                 Previous topic | Next topic          Author  
Message        waveuponwave          Post subject: Multiple index array 
help.Posted: Sat Jun 26, 2010 12:15 am                                 
Joined: Fri Jan 29, 2010 12:39 pm
Posts: 319
Location: Virginia U.S.A.                I really have no idea how to even try 
to do this. But I must. So I am looking for any help possible here. I have a 
calendar with 37 indexes. There are multiple events for each day. I need to 
pull the event description from the database and draw it on the correct day. 
Let's say on the 16th of the month I have two events. "Go out to eat" and "wash 
the dog", and both of those strings are now appended into an array. How would I 
even begin to go about drawing both of those strings on separate lines on the 
correct day? Can anyone help? Any ideas would be greatly appreciated as I am 
totally stuck. Thanks.      
_________________
RB2010r2 Pro on Win 7
I promise to help if I ever learn how to help myself.  
                             Top                 jefftullin          Post 
subject: Re: Multiple index array help.Posted: Sat Jun 26, 2010 1:15 am         
                        
Joined: Wed Nov 15, 2006 3:50 pm
Posts: 1678
Location: England                Calendar.
Multiple events for each day.

Got that.
Where does the multiple index thing come into it?
No month has more than 31 days, so I'm not sure if you meant 37 days.

Your database has entries that have a date and a note. (Maybe a type too: 
holiday, birthday, workday...?)

So for each day of the month, you get all the rows that match the day.
You append all the notes together with an endofline character between each.
And you draw the words inside the 'cell' that can contain them, using wordwrap 
to ensure that the words dont spill into the next cell.
Or you add some icons into the cell to show that there is some text to be read, 
and display the text if the mouse hovers over the cell.

You can represent the calendar as a listbox with a number of columns.
Convention is that you have 5 or 6 rows of 7 columns

Some people have each column represents a day of the week, and you number day 1 
on the actual day that it occurs.
(ie 1st Set might be row 0, col 4 if it fell on a Thursday)

Or you can always have 5 rows, and always have the 1st as row 0, col 0



If that doesnt sound like what you want to do, where do 37 indexes come into 
it?      
_________________
RB2009 R5.1 and RB2008
Mac 10.6 + Windows 7/XP  + Ubuntu Linux in Vmware
on a Macbook 2.16  
                             Top                timhare          Post subject: 
Re: Multiple index array help.Posted: Sat Jun 26, 2010 1:17 am                  
       
Joined: Fri Jan 06, 2006 3:21 pm
Posts: 7961
Location: Portland, OR  USA                First, you MUST NOT try to make some 
correlation between array index and calendar date (as you appear to be doing 
based on your other posts).  You need to gather paired sets of data:

Date, Event

Either make a class to hold each event or use parallel arrays.  Now when you 
draw the calendar, loop through your events and draw them to the appropriate 
date.  It's really not that hard.   
                             Top                waveuponwave          Post 
subject: Re: Multiple index array help.Posted: Sat Jun 26, 2010 2:19 am         
                        
Joined: Fri Jan 29, 2010 12:39 pm
Posts: 319
Location: Virginia U.S.A.                Tim I would be forever grateful if you 
could provide a small example of what you mean. I really don't have any other 
way to learn than through here. Thank you both.      
_________________
RB2010r2 Pro on Win 7
I promise to help if I ever learn how to help myself.  
                             Top                 jefftullin          Post 
subject: Re: Multiple index array help.Posted: Sat Jun 26, 2010 2:47 am         
                        
Joined: Wed Nov 15, 2006 3:50 pm
Posts: 1678
Location: England                Tim is right.
I hadnt read your other posts on the same topic, but all of them stem from your 
belief that you have to have SOMETHING in all 37(still..why 37) elements of an 
array.
(Thats not 37 indexes by the way)

Forget days of the month for a moment.
The numerical nature of these is what has polarised your thinking.

Imagine your 'top ten' friends.
Each of these MAY own a car.
You only store this in the database if they have a car

If you have these in a database and you select name, car, then clearly for some 
of these rows you will get null returned.
Not a problem.. you dont care because they dont have a car.

If you wanted to take that list of people and add them to a listbox, you MIGHT 
list the 10 names because you already know then.
For each name in turn, you go to the database and ask 'what type of car has 
Brian got'?
You may get no row returned.
Thats OK. Do nothing, move to the next friend.


You may think: well, I'll put everyone I know in the database. If there is no 
car, I will leave the car type as null.
Thats OK too, but wasteful.. 2000 friends who only have 2 cars between them 
means 1998 pointless records.


Going back to your calendar :
For each date of the month,one by one, go to the database and ask 'what events 
occur on THIS date'?
If there are no rows returned, no problem. 
Do nothing

If there are some rows returned, show 'Hit' in your planner.

Once you have that working, change the 'show hit' business to 'show details'    
  
_________________
RB2009 R5.1 and RB2008
Mac 10.6 + Windows 7/XP  + Ubuntu Linux in Vmware
on a Macbook 2.16  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 5 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to