Jump to content

Looping through Value List


This topic is 2513 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I have a Value List "Quarter" with values:

"Summer"
"Fall"
"Winter"
"Spring"

I planned to loop through these values and assign to a field using the various posts in the forum, but in testing the basic steps it's not working:

Set Variable [$i; Value: 1]
Set Variable [$quarters; Value: ValueListItems (Get (FileName); "Quarter")
Set Variable [$count; ValueCount ($quarters)]

New Record/Request
Set Field [Program::ProgramQuarter; GetValue ($quarters; $i)]

The field ProgramQuarter is not being set to any value....

Link to comment
Share on other sites

Thanks for Dialog Box idea and you are correct, the variable $quarters is empty and the $count is 0. However, I created a new file and just added the Value List and the script and it worked perfectly

My DB solution was originally created in FM13 and now developing in FM15...  Not sure how best to proceed

Edited by crazybake
Link to comment
Share on other sites

Sorry for the vagueness. I started the solution in FM Pro 13 and within the last two weeks upgraded to 15. As a test, I simply created a new DB and only added the few elements I mentioned - and it worked. However, this does not help me fix the original solution I created and I cannot find out what the issue might be. Each element is the same between the original solution and the new one ( Value List and Items and the script). I guess I am asking... are there issue when moving solutions from 13 to 15 and higher? I did download 16, but still had the same problems...

Would the best way be to create a brand new DB and import everything?

Link to comment
Share on other sites

No. It should be an extremely simple problem and should work in all those versions.

You are leaving out or wrong about some simple detail.

Also; you mention a loop; but nothing about your solution uses a loop (yet). But the first step should work.

i suggest you post your file or post an actual copy ( screenshot ) of your script.

Link to comment
Share on other sites

The top two images are a script and the Value List - part of the solution that I have been working with for some time. Everything is disabled after the steps I mentioned above and with the addition of a dialog box. 

The bottom two images are a brand new solution with no fields or tables and with the script steps copied and pasted from my original solution. Script works in bottom, but not top

5915ca417fef6_ScreenShot2017-05-12at7_42_42AM.thumb.png.3445522ddf9993d646f2c05bf9cd79d5.png5915ca424e90a_ScreenShot2017-05-12at7_42_21AM.thumb.png.922a0284f473028b9711d4f332700b30.png5915cae381ecd_ScreenShot2017-05-12at7_46_38AM.thumb.png.73833a1daea96dcf0573436b49ab534e.png5915cae43ebaf_ScreenShot2017-05-12at7_46_26AM.thumb.png.64defa8053e6fb99b3556e72b65fd37d.png

Edited by crazybake
Link to comment
Share on other sites

"Doesn't work" means what exactly?

Also: for current file you can use ValueListItems ( ""; "quarter" )

Also: what exactly is the current file name - you are using non-recommended characters?

Edited by BruceR
Link to comment
Share on other sites

Interesting... Changing Get(FileName) to "" solved the issue....? 

Meaning, that previously, the dialog box would not display any results with the exception of the counter. With the change to "" it is now displaying results for each variable correctly.  Thanks for the continued assistance!

Link to comment
Share on other sites

Actually it IS documented. See FileMaker help, example here for ValueListNames.

"If no parameter is specified for fileName, FileMaker returns results for the current file."

Link to comment
Share on other sites

5 minutes ago, BruceR said:

Actually it IS documented. See FileMaker help, example here for ValueListNames.

"If no parameter is specified for fileName, FileMaker returns results for the current file."

The quoted sentence does not appear in the help page for the ValueListItems function - which is the function we are discussing here. 

What's even more interesting is that it has now been removed from the help page for the ValueListNames function too:
http://www.filemaker.com/help/16/fmp/en/#page/FMP_Help%2Fvaluelistnames.html%23

 

 

Link to comment
Share on other sites

Help seems to be inconsistent on this subject across versions.

The referenced statement exists for ValueListNames help in previous versions; and these functions began in FM6.

And it continues to function correctly.

Link to comment
Share on other sites

It IS documented; but the topic has been elevated appropriately within the help structure.

Look under the Notes section within the general Design Functions topic.

If you specify no filename (""), functions return results for the current file.

As mentioned.

design functions.png

That's what DOCUMENTED means.

Link to comment
Share on other sites

3 minutes ago, BruceR said:

Look under the Notes section within the general Design Functions topic.

If you specify no filename (""), functions return results for the current file.

Okay, then starting with version 16 it has moved from "undocumented' to "poorly documented". 

Link to comment
Share on other sites

You will find the sentence more or less randomly included in help for specific design functions in previous versions.

Rolling it up to a single blanket statement within the higher level Design Functions topic seems like a good idea.

It seems clear to me that this is how it is intended to work; these are all old, unchanged functions.

YMMV, of course.

Link to comment
Share on other sites

This topic is 2513 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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