Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Create a value list that shrinks using 1 file only


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

Recommended Posts

Posted

How can I create a value list of numbers 1 through 10 and each time the value is used, the value is removed from the value list without having to use a second file but rather all in one file. I've done shrinking value list based on related files. I want to just use 1 file...

I first attempted by first creating a calculation field that results in a text of 1

Posted

I've got a solution to this. All it requires is another file, a relationship and a script. Is it worth it? You be the judge. smile.gif

In your MainFile you need 2 fields:

'c' a calc such that c = 1

'thing' a text field

In your RelatedFile you need 2 fields:

'c' a calc such that c = 1

'ShrinkingListField' a text field

This file will only ever have 1 record. This creates, in effect, a 'Universal' field, which is like a global, but is not specific to a specific user or session.

Create a relationship in MainFile to RelatedFile c=c

In MainFile you need 3 Value lists:

BaseValueList = the values you want to start with

UsedThings = from field Thing

ShrinkingList = from field RelatedFile::ShrinkingListField

Then you need to give your Thing field a button definition so that it launches a script:

SetField ["RelatedFile::ShrinkingList" , Substitute(ValueListItems( Status(CurrentFileName), "BaseValueList"), ValueListItems( Status(CurrentFileName), "UsedThings"), "")]

Go To Field ['Thing']

Format field Thing to use Value List ShrinkingList, and don't allow entry into the field.

Good Luck,

Dan

Posted

I guess you could do it with one file though. Instead of a second file acting as the universal field, just have it be in the first record of the main file. In the script, always go to record #1, then set the field, and then return to the original record. It may take some extra steps to make sure that the first record is in the found set, and that you get back to the found set you had before you started. And of course if #1 gets deleted, you could get screwed up.

Posted

I've edited the previous attachment with some cross-platform correction. Let me know if the exit on pause script sucks on Windows, I cant check it

Thanks...

Posted

Hi Ugo, I looked at your sample file and it seems that the dynamic list doesn't get changed for each record. It appears to me that for each record there has 10 options.

i.e. For record 1, if I assign 3 to it and proceed to record 2, 3 is still available as another option when it fact that it should not be since 3 was already assigned to record 1.

What am I missing?

Thanks.

Posted

I wasn't pretty sure of what your needs were.

Jump to Demo 2 on this attachment to see it work on as many records as you wish (as long as the g_repetition is filled. It's limited to 100 here)

I've made it so that you could eventually add records, so it's a 10 record file, linked through a constant.

If you need something else, or some explanations, just ask. I've been putting it rather quickly.

Both Demo use different scripts and relationships, but they work the same way.

Though, you have to reset the lists from one demo to the other, as they aren't dependant each other. I think I've included it in the scripts. Not sure though.

Edited:The New record step was buggy. Seems to work now

DynamicRepeatListv2.fp5.zip

Posted

Hi Macaroni,

With some more time today, I went back to this tip and made some corrections.

It should really get you there now. I skipped the first part as it could be confusing. Instead of a constant relationship, this technique could be applied to any single Self-Relationship. smirk.gif

I liked the way repetitions could be implemented, even if this file offers feature you don't bother with.

The more I think of it, the more I feel like it should be even more easy for a single 10 records list to be scripted.

Dan's idea could work too BTW, but this one may have some other implementation, which is why I went this way.

DynamicRepeatListv3.fp5.zip

This topic is 7626 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.