Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Hello, I have a Case calculation that does not return what I expect

wd1 = width of image in container1 , ht1 = height of image in container1

wd2 = width of image in container2 , ht2 = height of image in container2

A script would open up a popup window sized to the parameters of the image in the container. This is how it starts:

Set Variable [ $contfield; Value:Get ( ScriptParameter ) ]  //which is the name of container1 or 2 which it gets correctly

Set Variable [ $ht; Value:Case (
$contfield = Untitled::container1; Untitled::ht1; 
$contfield = Untitled::container2; Untitled::ht2; 
"ERROR") ]

Set Variable [ $wd; Value:Case (
$contfield = Untitled::container1; Untitled::wd1; 
$contfield = Untitled::container2; Untitled::wd2; 
"ERROR") ] 

The calculations return "ERROR". Which I don't understand as I would expect $ht/wd to be set to the corresponding numbers in ht1/2 and wd1/2. What am I doing wrong?

Thanks

so $contfield resolves to Untitled::container1, not just container1? How is the script parameter set?

And you may need quotes to match literal text, rather than whatever the value of the field is...

And why not just pass the width and height in the script parameter in the first place?

Edited by webko

  • Author

Script parameter set by specifying Optional Script Parameter as GetFieldName ( Untitled::container1 )  or 2 depending on the field clicked. Yes, it resolves to Untitled::container1/2. And this is a simple test file with one table.

I am not sure how to set two different script parameters with one step. 

The test:

$contfield = Untitled::container1

will return true only when the contents of the variable match the contents of the field - in your example, that would be true only if the container field contained the text "Untitled::container1". To test that the variable contains the name of the field, you need to do:

$contfield = "Untitled::container1"

or preferably (so that you can change the field's name without breaking the calculation):

$contfield = GetFieldName ( Untitled::container1 )

 

There's probably a shorter way to get what you want. How are the fields wd1, ht1, wd2 and ht2 populated?

  • Author

$contfield will be different depending on which field will activate the script, thence the need for a script parameter. 

wd/ht are calculations: GetContainerAttribute ( container1 ; "width" ) etc. I'm sure this could be tighter but this is just a test file.

 

I tried adding explicit "-s to the FieldName but it still does not work

2 hours ago, Asu said:

I tried adding explicit "-s to the FieldName but it still does not work

If the script parameter is set to be =

GetFieldName ( Untitled::container1 )

then it contains the string "Untitled::container1". If you're seeing something else, then there something you're not telling us.

 

2 hours ago, Asu said:

wd/ht are calculations: GetContainerAttribute ( container1 ; "width" ) etc.

If the only purpose of the fields is to serve this script, then you could eliminate them. The parameter could be simply either 1 or 2, and then your script could just open a new window and calculate its height as =

GetContainerAttribute (
Case (
Get (ScriptParameter) = 1 ; YourTable::Container1 ;
Get (ScriptParameter) = 2 ; YourTable::Container2
) ;
"height" )

and a similar calculation for the width.

In fact, with only two fields, I would make the buttons perform the New Window step directly and specify the field explicitly.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.