Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Script to check consecutive numbering sequence

Posted on 2012-04-05
4
Medium Priority
?
328 Views
Last Modified: 2012-04-13
I Have a several  portal rows and the number of rows can vary from 1 to a max of 12.
The user needs to set the Task Sequence manually via a value list numbered 1.2.3.4.5. etc..12.
Task abdc, the first portal row and firt task  is numbered...1
Task bdcf..the second portal row is the second task and is numbered ...2(selected by the user)
Repeat until the total numbered of tasks have been sequenced.
The Sort Portal Records is set to Task Sequence ascending.
This all works well.
If the User in error selects a sequence ranging from 1  to 4 as  1... 2.. 3..5 instead of 1 2 3 4  
I need a script triger to alert the user to the incorect sequence.
I have a script that is based on :
  Go to Portal Row First ,If Task Sequence > 1 ..Show Custom Dialogue
Go to Portal Row Next    If Task Sequence > 2 then show custom dialogue
Again this is ok but the script will end at the last portal row each time which is not what I want.
Is there a shorter way  where the script will evaluate all the sequences entered per portal row and evalauate  if the sequences are in sequence ?
0
Comment
Question by:Krisraychris
  • 2
  • 2
4 Comments
 
LVL 25

Expert Comment

by:Will Loving
ID: 37814895
I'd like to offer an alternate, and i think more elegant, way of going about this - one that I have used on multiple occasions - that completely bypasses the need for the error message. Instead of having the user have to select the Sequence number for each portal record, just have a "next in sequence" area to click on in each portal row. When the user clicks the button area, a script calculates what the next sequence number would be using the Max() function and adding one. So for example:

Max( TaskItems::TaskSequence ) + 1

All the user has to do is select the items in the order that they want them and the next higher sequence number is assigned for them automatically. Clicking a task that is already numbered clears the Sequence number and let's it revert to an unordered state.

If you want to go further you can add a renumbering routine to the "click" script, so that if a user clears the Sequence value - in particular for a task in the middle of the sequence - the script simply runs a loop through all the portal rows that are numbered so far and renumbers them starting with 1. That way if the user clears a Sequence value on any record, the remaining sequence records will be renumbered and the gap eliminated.
0
 

Author Comment

by:Krisraychris
ID: 37831374
Hi
Pleasde have alook at the script I am using to get the sequences to increment by one.
It is doing the right things sometimes.On the second click the  highest sequence is plusses a 1.
I have tried go to Record/ Request/Page and this cuases some problems as I may have two sets of sequences open soi I opted for Go to portal row next.
I would appreciate your advice on this.I have changed the filed names of the script for simplicity. The fieedTask Sequence Monday is located in a Table Task  Monday

Go to Layout [ “ Day Monday”  ]
Go to Portal Row [ Select; First ]
If [ IsEmpty( Task Sequence Monday ) or Task Sequence Monday < 1 Task Sequence Monday> 1 ]
Set Field [ TaskSequenceMonday ; 1 ]
End If
Loop
Go to Portal Row [ Select; Next ]
Set Variable [ $TaskSequenceMonday; Value:  TaskSequenceMonday]
 
Set Variable [ $TaskSerquenceplus1; Value:Max(TaskSequenceMonday)+1 ]
 
 
Set Field [ TaskSequenceMonday; $TaskSequenceplus1]
 // Go to Record/Request/Page [ Next; Exit after last ]
Exit Loop If [ PROD ORDER FinishTime Monday::Count Records Total = 10 ]
End Loop
0
 
LVL 25

Accepted Solution

by:
Will Loving earned 2000 total points
ID: 37832832
To clarify, are you trying to do my suggested method or your original method? Assuming you are trying to do my suggested method I think you may be doing more than necessary. Take a look at the attached example file which shows a simple setup for assigning sequence numbers to records in a portal. It includes a script attached as a button to each portal record and a relationship that is sorted to first put sequence portal rows first, followed by unassigned (though you could certainly to the opposite and put unassigned at the top by changing the sort order applied to the relationship).

I have not added a renumbering sequence do deal with removing ones out of order but it's not difficult and could easily be added to the script.

Portal Row SequencingClick-to-Sequence.fp7
0
 

Author Closing Comment

by:Krisraychris
ID: 37841858
Thank you for your sample file.I have used elements of this example and used it fully in another table.Much appreciated !!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem: You have a hosted FileMaker database and users are tired of having to use Open Remote or Open Recent to access the database. They say, "can't you just give us something to double-click on rather than have to go through those dialogs?" An…
Having just upgraded from Filemaker 11 to Filemaker 12 over the weekend, we thought we would add some tips for others making the same move.  In general, our installation went without incident. Please note that this is not a replacement for Chapter 5…
Loops Section Overview
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question