AnsweredAssumed Answered

DRY coding and Script Parameter

Question asked by Cécile on Oct 29, 2018
Latest reply on Oct 31, 2018 by Cécile

My navigation script was working but for only one of the 4 tables that employ the same structures and layout. So I decided to DRY code it and pass parameters. It is not working. I am tempted to just make 4 navigation scripts that work instead of this one that doesn't work. But I am posting the problem here to see if it is only a grammar issue.

 

The script parameter is set like this:

 

List("next";Quote (¥::ID_¥))

 

This is the script that tells the portal to display the next, previous or 2 next up, 2 previous down, records

 

Let($x = Case(

GetValue ( Get(ScriptParameter );1)= "previous";-2;

GetValue ( Get(ScriptParameter );1)= "next";+2;

GetValue ( Get(ScriptParameter );1)= "previousOne";-1;

+1);

GetValue ( Get(ScriptParameter );2) & $x

)

 

navigate.jpg

 

As an FYI, in case it somehow interferes, below are filtering calculations for the one-row portals that are supposed to "navigate" to display another record.

It is a self joined table. Both portals are filtered in function of the value visible in editbox £::ID_£ (original table) to display either odd or even records from the TO µ£. The calculation below display only odd results in the portal.

 

Case(

Mod(£::ID_£+2;2)=1;

µ£::ID_£=£::ID_£+1;

 

Mod(£::ID_£+2;2)=0;

µ£::ID_£=£::ID_£

)

Outcomes