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

  • Below is an image of my Script.
  • Problem Area:(Highlighted in Yellow) Set Field [Table::Vehicle_Description1; $&"VD&$i
  • Goal: Variables $VD1-$VD8 are holding data.  I am doing a loop $i which is a counter that increments from 1 to 8.  If there is Data within the variable then I want the field Vehicle_Description1 to be filled with $VD1 on the 1st iteration.

     

  • Current Output:  When running the script, assuming data is in $VD1, I am getting VD1 within Vehicle_Description1 instead of what data is within the variable $VD1.

     

  • What is unusual:  The counter $i is working fine.  You can see this with the output VD1

     

  • InShort: How do you read a variable when you have to concatenate and read a dynamic variable?

     

  • Any help or suggestion would be much appreciated. :laugh2::worship: 

     

fm_pro3.jpg

Set Field [ table::Vehicle_description1; Evaluate( "$VD" & $i )]

  • Newbies

Or use repetitive variable $VD[1], $VD[2] etc....  by loop  $VD[$i]

  • Author

 ricardor  BruceR--> Thank you, thank you. :worship:  :worship: 

I did not know about Evaluate() but I figure that had to be a way.  

I also would have never known about repetitive variables.  It sound as if I do not need to use a counter if I am using a repetitive variable.  Wow, that is cool.

Learned two new things today.

Thank you both again for the valuable feedback, much appreciated. :party: 

Yes, I agree that repeating variables are the better approach.

  • Author

Or use repetitive variable $VD[1], $VD[2] etc....  by loop  $VD[$i]

This is going to sound stupid, :grad:  but how might I do this.

 

Objective: I want to initialize 8 variables VD1 thru VD8 to "". 

Error: Set Variable[$VD[$i]; Value:""]

Logic: Might not be correct either

Goal: Use repetitive variable within looping to simply and compress code

 

Below is the code I have come up with thus far:

Set Variable[$i: Value:1

Loop

Set Variable[$VD[$i]; Value:""]

Set Variable [$i; Value:$i+1]

Exit Loop If[$i >=8]

End Loop

 

:hmm:

That's a pretty reasonable approach to set a repeating variable. I would make a couple nitpicky minor changes, but the script is sound.

 

Keep in mind that unlike a lot of programming languages, FileMaker does not "initialize" variables. To FMP, an empty variable is a non-existant variable. Some FMI engineers may strike me down, but there is no difference between "empty" and "null" variables.

FWIW I generally prefer putting the exit condition at the top of the loop.

 

That way you know nothing ever gets processed if it does not satisfy the exit condition.

In this case the process is very simple but in more complicated scripts it makes it easier to assure yourself that it is OK to take this action (change data, delete a record, whatever)

Sort of like saying, only touch this data if...

 

 

Set Variable[$i: Value:1

Loop

Exit Loop If[$i >8]

Set Variable[$VD[$i]; Value:""]

Set Variable [$i; Value:$i+1]

End Loop

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.