Jump to content

Numbering sort/group field in portal


MikeKD
 Share

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

Recommended Posts

Hi folks,

On my class layout (class table), I have a portal of that classes assessments (assessment join table), and when I select one the pupils (Pupils table) all come up so I can give them their marks, notes and attendance.

 

This all works very well indeed (mainly because of the help you guys have given me!)

 

One of the fields on the portal is a sort number (from a pupil_class_assessment_join table). I use this to put the kids into the groups they're working in.

 

At the moment I do this by hand, just typing in the numbers.

 

It would be great to automate this sometimes. I'd like to have a popup giving me the option run various scripts:

 

  • Allocate numbers by random. Using a preset field to say how many numbers (groups) would be used.
  • Allocate numbers into ability groups; i.e the brightest kids all in one group and the weakest in another.
  • Allocate numbers into mixed ability groups: a range of abilities in each group.
  • Copy the numbers from the last assessment.  This one has got me really stumped!

Can I do this within the portal using go to next row, or do I need to find and jump to new layouts to replace field contents that way?

What's the best way to set the multiple variables - should I use $CODE(KidsID) kind of thing?

 

Many thanks,

Mike

 

PortalSort.tiff

Link to comment
Share on other sites

OK, well I've kind of got the random group working using the following script.

Go to Object [ Object Name: "Register Portal" ] Go to Portal Row
[ Select; First ]
Set Variable [ $number; Value:Int(Random * Classes::NumberOfGroups) + 1 ] Loop
Set Field [ Pupil_Class_Assess_Join::Sort; $number ]
Set Variable [ $number; Value:Int(Random * Classes::NumberOfGroups) + 1 ]
Go to Portal Row
[ Select; Next; Exit after last ] End Loop

But, I've gone about it the wrong way - I've given a random group number to each pupil. This means that the group sizes can vary randomly - if I ask for 3 groups, the script could potentially give me 0 members in two of them.

 

I have another script which sorts into groups alphabetically:

Go to Object [ Object Name: "Register Portal" ] Go to Portal Row
[ Select; First ]
Set Variable [ $number; Value:1 ] Loop
Set Field [ Pupil_Class_Assess_Join::Sort; $number ]
Set Variable [ $number; Value:$number+1 ]
Go to Portal Row
[ Select; Next; Exit after last ]
If [ $number = Classes::NumberOfGroups + 1 ]
Set Variable [ $number; Value:1 ] End If
End Loop

This is more useful at the moment. I wonder if I could script a sort of the portal before using this - I could then sort randomly, by current achievement and use that for groups.


Ah, I just spotted that you can use a calculation in the Go to Portal Row step.

Could I use that to go to rows randomly / in order of achievement?

Link to comment
Share on other sites

I've had a stab at grabbing and copying a field from a previously selected assessment.

I /think/ my problem is in generating variables for each individual pupil from a record and then settting that field in the later record.

I've tried repeating variables using Code(PupilID). But I'm not sure how that works - will research.

 

Here's what I've got so far...

Set Variable [ $Class; Value:Classes::ClassID ]
Go to Object [ Object Name: "AvailableAssessPortal" ]
#Is this the best was to select the 2nd portal row?
Go to Portal Row
[ Select; First ] Go to Portal Row
[ Select; Next ]
Set Variable [ $PreviousAssessment; Value:Assessments::AssessID ]
#Am I best using the AssessID & ClassID to filter records on that layout OR
Can I do that through the portal
Go to Layout [ “Pupil_Class_Assess_Join” (Pupil_Class_Assess_Join) ]
Perform Find [ Specified Find Requests: Find Records; Criteria: Pupil_Class_Assess_Join::GradeID: “=$PreviousAssessment” AND Pupil_Class_Assess_Join::ClassID: “=$Class” ]
[ Restore ]
Set Variable [ $FoundSetTotal; Value:Count ( Pupil_Class_Assess_Join::ThisAssessID ) ]
#Now I need to set a variable for each record's Sort Field.
If I sort the records the same as they're sorted in the portal I can just use $1 - $??
Go to Record/Request/Page
[ Next ] Loop
Set Variable [ $Sort1[Code ( Pupil_Class_Assess_Join::PupilID )]; Value:Pupil_Class_Assess_Join::Sort ] Go to Record/Request/Page
[ Next; Exit after last ] End Loop
#Now back to the portal to fill in the Sort field
Go to Layout [ original layout ]
Go to Object [ Object Name: "Register Portal" ]
Go to Portal Row
[ Select; First ] Loop
Set Field [ Pupil_Class_Assess_Join::Sort[Code ( Pupil_Class_Assess_Join::PupilID )]; $Sort1 ] Go to Portal Row
[ Select; Next; Exit after last ] End Loop
Link to comment
Share on other sites

mmm; this thread is turning into a journal..

 

I think the above script is working OK until the time I return to the original portal and try to write the $Sort1 variable into the sort field.

I've generated a separate variable for each pupil - $Sort1[Code ( Pupil_Class_Assess_Join::PupilID ) - but can't work out how to get it into the field. There's nothing in FM documentation or the iBook, will carry on searching.

 

I may be some time!

Link to comment
Share on other sites

OK; rethink and script V2

I couldn't work out how to unload the variables back into the portal, so in this one I'm trying to grab one at a time.

It still doesn't work - haven't quite worked out where it falls down yet...

Also, I need to look up ways out of the loop; I can set a $counter, but not sure yet how to find out how many rows there are; suspect there with be a Get function, but can't find it!

#Set Class & Current Asses Variable.
Set Variable [ $Class; Value:Classes::ClassID ]
Set Variable [ $CurrentAssess; Value:Pupil_Class_Assess_Join::GradeID ]
#Go to second last Assessment & Set that Variable.
Go to Object [ Object Name: "AvailableAssessPortal" ]
#Is this the best was to select the 2nd portal row?
Go to Portal Row [ 2 ] [ Select ]
Set Variable [ $PreviousAssessment; Value:Assessments::AssessID ] #Go back to Register portal to get PupilIDs and finding records that match. Go to Object [ Object Name: "Register Portal" ]
Set Variable [ $PortalRow; Value:1 ]
#
Loop
Set Variable [ $PupilID; Value:Pupils::PupilID ]
Go to Layout [ “Pupil_Class_Assess_Join” (Pupil_Class_Assess_Join) ]
Perform Find [ Specified Find Requests: Find Records; Criteria: Pupil_Class_Assess_Join::PupilID: “=$PupilID” AND Pupil_Class_Assess_Join::GradeID: “=$PreviousAssessment” AND Pupil_Class_Assess_Join::ClassID: “=$Class” ]
[ Restore ]
Set Variable [ $SortNo; Value:Pupil_Class_Assess_Join::Sort ]
Perform Find [ Specified Find Requests: Find Records; Criteria: Pupil_Class_Assess_Join::PupilID: “=$PupilID” AND Pupil_Class_Assess_Join::GradeID: “=$CurrentAssess” AND Pupil_Class_Assess_Join::ClassID: “=$Class” ]
[ Restore ]
Set Field [ Pupil_Class_Assess_Join::Sort; $SortNo ] Go to Layout [ original layout ]
Set Variable [ $PortalRow; Value:$PortalRow+1 ] Go to Portal Row [ $PortalRow ]
[ Select; No dialog ] End Loop
Link to comment
Share on other sites

mmm; this thread is turning into a journal..

 

I do my journaling in my file, not on the forum. Reading someone else’s journal tends to put me to sleep.

 

Maybe when you have a file for us to test, post it.

Link to comment
Share on other sites

Sorry Lee,

the file this is a part of has already been described as a "thicket" on the this forum.  You guys give so much time as it is, I was just after a few vague hints and didn't want someone to have to spend the time hacking through my incompetent undergrowth.

 

I'll wind up my journal now though - hope it's useful to some of the insomniacs on the forum!!

Link to comment
Share on other sites

This topic is 2862 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
 Share

×
×
  • Create New...

Important Information

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