AnsweredAssumed Answered

Starting my first custom function

Question asked by dbail22@comcast.net on Mar 2, 2017
Latest reply on Mar 5, 2017 by DrewTenenholz

I am attempting to convert a script into a custom function but my lack of knowledge has me stumped.  Below is a simple function called by TopPortalRow(PortalName,FieldName,start). It tests a named field in a portal row of a named portal to see if the field (portal row) is below the top of the portal.  Works fine in a script and Loop-End Loop but not here.   I feel it is something simple in the last line but cannot figure it out.  An additional simple question is what value is returned in such a function. I was trying to make it n but not getting anywhere.  Thanks in advance for any help.

 

David

 

 

/* Calculate the top of the portal passed in the name  */

Let (p = GetLayoutObjectAttribute(PortalName;"Top";"");

 

/* Calculate the top of the specified portal row using a named field  */

Let (r = GetLayoutObjectAttribute(FieldName;"Top";n);

 

/* Test to see if r-top of portal row is greater than p-top of portal

     If not call the function again with n+1 or return with n  */

Case(p>r;n;FirstPortalViewed(PortalName;FieldName;n+1))))

Outcomes