AnsweredAssumed Answered

sorting portal rows with drag and drop functionality

Question asked by johnhorner on Jan 19, 2010
Latest reply on Jan 21, 2010 by eX-Christo


sorting portal rows with drag and drop functionality


i recently came across a demo file that had the ability to sort portal rows using a drag and drop style method.  it relied on a short script (the script is also copied below if needed) which is triggered when you enter the field ("handle") in the portal row and then relied on an auto-enter calculation in the same field ("handle") which was as follows:


Let ( [
_trigger = handle ;
_sortdown = Get ( ScriptParameter ) > sort ;
$$sort_id = id ;
$$slide_down = ase ( IsEmpty ( Sort LOWER::sort ) ; sort – 1 ; ( sort + Sort LOWER::sort ) / 2 ) ;
$$slide_up = Case ( IsEmpty ( Sort HIGHER::sort ) ; sort + 1 ; ( sort + Sort HIGHER::sort ) / 2 )
]; Main::gGraphics [ 6 ] )


i am trying to understand how this works.  i have 3 questions about this function:


1.  what is "_trigger"?  i don't see it referenced anywhere else in the file as a field, a variable, a script name or a table occurrence.  is it a variable?  don't variables have to begin with either "$" or "$$"?

2.  what is "_sortdown?  (same issues as above for "_trigge

3.  finally, i don't understand how the line "_sortdown = Get ( ScriptParameter ) > sort" works.  how you can use a "Get(ScriptParameter)

  3a.   how you can use a "Get(ScriptParameter)" when this is not in a script (it is in an auto-enter calculation).

  3b.  assuming that "_sortdown" is a variable for the sake of this particular question, what does it mean to set a variable equal to something ">" (greater than) something else? for example, if the script parameter was "3" and sort was "5" how can a variable = 3>5?


i know these are probably really stupid questions, but despite many hours trying to figure this out, i am at a loss.  any help would be much appreciated.  thanks!


p.s. here is the script:


If [ Sort::id <> $$sort_id and not IsEmpty ( $$sort_id ) ]

    Set Field [ Sort::sort; Case ( Sort::sort > $$slide_down ; $$slide_down ; $$slide_up ) ]
End If

Commit Records/Requests

Set Variable [ $$sort_id; Value:"" ]