Jump to content

CF_Values_WordLength


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

Recommended Posts

Hi,

 

given a list of this 30 values

 

1  

1 18

1 18 30

1 18 30 39

1 18 30 39 45

1 18 30 39 45 46

1 18 30 39 45 41

1 18 30 39 45 46 41

1 18 30 39 46

1 18 30 39 41

1 18 30 39 46 41

1 18 30 45

1 18 30 45 46

1 18 30 45 41

1 18 30 45 46 41

1 18 30 46

1 18 30 41

15 18 30 46 41

15 18 39

15 18 39 45

15 18 39 45 46

15 18 39 45 41

15 18 39 45 46 41

15 18 39 46

15 18 39 41

15 18 39 46 41

15 18 45

15 18 45 46

15 18 45 41

15 18 45 46 41

 

I would like to be able to get 

list of values with fixed words length, in this case 5 words values:

 

1 18 30 39 45

1 18 30 39 46

1 18 30 39 41

1 18 30 45 46

1 18 30 45 41

15 18 30 46 41

15 18 39 45 46

15 18 39 45 41

15 18 39 46 41

15 18 45 46 41

 

The CF should get two values: the list of values and the number of words

 

I was trying to modify the CF called LongestValue http://www.briandunning.com/cf/1244

with no luck. 

Also looking for if any could fit and not found anything. 

 

The CF could be enhanced with more sophisticated adjustment but now is what  I need.

 

Thanks in advance,

 

Link to comment
Share on other sites

To return only values that have a given number of words, you could do something like:

 

ValuesByWordCount ( listOfValues ; numberOfWords ) =

Let ( [
item = LeftValues ( listOfValues ; 1 ) ;
countValues = ValueCount ( listOfValues )
] ;
Case ( WordCount ( item ) = numberOfWords ; item )
&
Case ( countValues > 1 ; ValuesByWordCount ( RightValues ( listOfValues ; countValues - 1 ) ; numberOfWords ) )
)

-

 

The CF should get two values: the list of values and the number of words

 

I don't think that's a good idea; a function should return one result, of one type only. In any case, the number of words returned is easily calculated by multiplying the value count of the result by the given number of words, or just applying WordCount() to the result.

 

 

The real question here is why aren't you using Filemaker's records and fields to store your data; processing such structured data is much easier.

  • Like 1
Link to comment
Share on other sites

Hi Comment,

 

 

 

ValuesByWordCount ( listOfValues ; numberOfWords ) =

 

It works perfect for me!!!

Thank you !!

 

 

 

The real question here is why aren't you using Filemaker's records and fields to store your data; processing such structured data is much easier

 

OK. You've solved it, you deserve a clean answer

 

I was trying, just for fun(*), with a friend of mine(**) to solve this issue:

 

how many times this combination 15, 18, 30, 39, 45, 46 (+41) has appeared before in the lotto (I think there is such a lottery in most countries). Well not exactly that combination (just once, of course) but its "essence", that is, 5 value combination of any of those numbers. 

 

We have the 7 numbers of each raffle (¿¿??) in 7 fields and we wanted to know many combinations of 5 have been appeared before. 

 

The combination stuff is solved with CF AllWordCombinations but gives us a 127 value list. Cause we were not able to extract only the fixed word length, we started to think how to extract the data with, lets say 5 value combination from the list as issued. 

 

We also have not been able to devise a better data estructure that this of combine each individual number, ordered, just to obtain ordered keys to get compared with hundreds of other combinations. So we will have a multikey relationship that will answer the how many times 5 combinations to this raffle [15, 18, 30, 39, 41, 45, 46] has appeared before in the lotto.

 

Thanks again, Comment

 

 

(*)Just for fun yes, but if any kind participant wants to share his/her CF_next_lotto_big_prize, it would be interesting to be tested.

(**) My friend pointed me to http://www.scientificamerican.com/article/math-explains-likely-long-shots-miracles-and-winning-the-lottery/

and we started to… 

Link to comment
Share on other sites

Well, as long as you don't take it seriously ...

 

Still, for the record, you should have an individual record for each number drawn, along with a parent table of drawings. If you think that the position of the number in that week's combination holds any significance (which is very doubtful, because that would indicate that the balls can communicate among themselves), then you should have a field for that, too. That way you can analyze the frequency of any phenomenon that you suspect to be less than random.

 

 

 if any kind participant wants to share his/her CF_next_lotto_big_prize

 

Why sure. Not exactly a custom function, but just as good as anything else you will come across:

http://www.filemaker.com/help/13/fmp/en/html/func_ref3.33.36.html#1029202

Link to comment
Share on other sites

 

Well, as long as you don't take it seriously ...

 

It simply can bring us to a couple of interesting CFs… 

 

The other collateral point for us is related to see which kind of combinations usually get with no big prix and go to a "pot" (I don't know if this is the term). Other ones are quite popular and do share the big one amongst 3 or even more people. Needless to say that this doesn't reveal the next winner combo but as soon as you see what it can be said if it would be in the popular bets or not. 

 

 

 

...you should have an individual record for each number drawn, along with a parent table of drawings. (...)That way you can analyze the frequency of any phenomenon that you suspect to be less than random.

 

I do not see your point. I can not guess why frequency as commented would be more analyzable in the number level cause it is the combination at the drawing level what we try to see. If my english is not properly be understood forgive me cause I am in a unknown slang level (bets I mean)   :clover:

 

If you can give some light in that direction I shall appreciate it.

Thanks, again, Comm!

Link to comment
Share on other sites

Well, it's hard to explain when I don't fully understand what you're after... 

 

In general, if you have a record for each combination drawn (with or without paying attention to the order), then you can summarize their occurrences in the general population using summary fields. Alternatively, if you know the probabilities of each individual number (which you can get from the child table where each number drawn is a record), then you also know the probability of any conceivable combination.

Link to comment
Share on other sites

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