Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7514 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi all:

I'm working on a scheduling system with a graphical display of a schedule, using the xmChart plugin. However, I'm having a hard time getting the formatting right for the chart data. For those of you unfamiliar with xmChart, if I've got three items on the agenda in a five day week, the data might look like this:

(0 0; //Monday, no meetings

12 14; // Tuesday, meeting from noon to 2pm

0 0; // Wednesday, no meetings

10 12 13 15; // Thursday, a meeting from 10-12, another from 1-3pm

0 0;) // Friday, no meetings.

Now, I've gotten to the point where I have my found set & am able to pull the data for the chartable items. What's NOT going right is being able to fill in the "0 0;" for empty days. Something is so wrong with my loop that I'm not even going to bother entering it here - I think my logic is faulty at the core.

The data I'm using includes having the day of the week represented as a number (for sorting purposes) as well as the numerical hours as shown above. I need to step through the sorted data and, for items that appear on a particular day, fit the numerical hours between the semi-colons; for days that have no meetings, I've got to have the "0 0;"...Can anyone show me the logic for this?

Thanks

-Stanley

Posted

Hey Stanley,

I've done several different types of charts with xmChart, so I may be able to help. What kind of records are you sorting? Are they days or meetings?

Posted

Ender:

Thanks for chipping in.

They're classes, actually. The data in the records (for the chart) is all numeric - nStartTime, nEndTime, nDayOfWeek. I've got it sorting, and pulling the right data - that's fine. But I'm not catching empty days.

Also, I'm working with a Gantt Chart (like the last sample on that page in the xmGallery file.)

Right now I'm using a very long list of If statements in a loop which runs through all the class records (once they've been sorted by day & start time), and I've got a global I am incrementing to track where I am. Each If checks for the day of the week, thus:

If [Classes::nDayOfWeek =1]

copy & paste hour data

End If

If [Classes::nDayOfWeek (isnot) 1 & Classes::gTracker = 1]

Insert Text [Classses::tChartText; "0 0;"

Set Field [Classes::gTracker; 2]

End If

This is reiterated for all 7 days of the week, within the loop. The idea being to track what day I'm on, and to use the gTracker to identify where to put in the "0 0;" lines. But it doesn't work. The first day (in my test) is empty, and it works then, but the gTracker stops at "2"...

-Stanley

Posted

How about something like this:

Set Field [ gTracker , 1 ] //Holds the last day of week

Set Field [ gChartText, "" ] //Holds the chart text as it's built

Go to Record/Request/Page [ First ]

Loop

If [ nDayOfWeek <> gTracker ]

If [ nDayOfWeek = gTracker+1 ]

Set Field [ gChartText, ChartText & "0 0;" ]

Else

Set Field [ gTracker , nDayOfWeek ]

Set Field [ gChartText , gChartText & ";" & <Hour Data> ]

End If

Else

Set Field [ gChartText , gChartText & ";" & <Hour Data> ]

End If

Go to Record/Request/Page [ Next ]

Exit Loop If [ gTracker >= 8 or Status(CurrentRecord) = Status(CurrentFoundCount)]

End Loop

Loop //In case there are no events late in the week, this puts empties in graph for those dates

Exit Loop If [ gTracker >= 8 ]

Set Field [ gChartText, ChartText & "0 0;" ]

Set Field [ gTracker , gTracker + 1 ]

End Loop

I'm not sure if it works, but that's probably how I would start.

Posted

Ender:

That didn't work, but you set me on the right path, especially regarding adding the last items to the list. I also discovered that I was skipping blank days in the middle, but I've (finally) got the thing figured out.

Thanks

-Stanley

Posted

Using the script debugger in Developer is especially helpful in debugging scripts like this (if you can afford it.)

Posted

Ender:

In the end, it was nothing the script debugger would have seen - all bad syntax in calculations, really (and bad calculations, too)...

-Stanley

This topic is 7514 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.