Well, you could use the List function on your repeating field,
and have that list in a Value List (by another calculation field with the List function),
then sort your portal by the Value List.
I haven't personally tried sorting by a value list to know how it exactly works.
& Just curios, are you rearranging the numbers in the repeating field manually (without buttons or scripts)?
Thanks for the reply, that's similar to what I was trying to work out.
What is in the screenshot is just the hidden function, there will be no numbers visible in the final product. It will be replaced with buttons and a drag and drop kind of sorting.
You can use an unstored calculation field with a numeric result in the child table and sort on that field.
That calculation would look something like:
repeating = List ( table::repeating ) ;
this.val = index.field ;
result = ValuePosition ( repeating ; this.val ; 1 )
A couple caveats with this code...ValuePostion() is a handy custom function that's easily replicated with regular old code (using Position(), Left() and ValueCount() ). And the List() on the repeating field won't return the needed result if you blank repetitions.
Just curious as to the reason for choosing a repeating field instead of related records in a portal, where portal records could be sorted by a number field, even if the number/field is not shown in the portal.
(This is the third question I've seen in a week about using repeating fields in situations which seem to beg for related records, so I had to ask, why?)
The repeating field is to list the related records that are shown in the portal.
There are two tables, "inventory" and "images" where the records are being related from.
The repeating field is to list image numbers and to help with sorting... especially when images show up on multiple records in inventory and the user wants them sorted differetly on each.
Going to make an attempt now with David's suggestion now.
Thanks for the help everyone!
Got it working with this as a calculation field on the image table... however next big step is to figure out how to have different image sorts based on inventory number.
You'll see in attached screenshots that inventory record number two is sorting based on number one.
list = List(inventory::Reference Image Number);
image = Image Number;
sort = ValueCount ( Left(list ; Position(¶&list&¶;¶&image&¶;1;1)) )
thanks for the help thus far!