Jump to content

count record with same fields


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

Recommended Posts

Hello everyone.

How can I set the calculated value of field C to the number of records having field A equal to the value inserted to field A and field B equal to the value inserted to field B?

 

For instance with the following situation

 

record 1  =>  A = "house", B = "pay" 

record 2  =>  A = "house", B = "win" 

record 3  =>  A = "car", B = "pay" 

record 4  =>  A = "house", B = "pay" 

 

when I create a new record having  A = "house", B = "pay"  C should automatically be 2 (since record 1 and 4 have the same A, B.

 

Thanks

Link to comment
Share on other sites

Please don't ask abstract questions; more often than not, they lead to the wrong answers. Instead, explain what kind of objects your solution is tracking and what do you need it to do for you. I suspect that once you do that, it will turn out that the real problem here is structural.

Link to comment
Share on other sites

Thank for you reply.

Sorry for my question but I feel it is pretty concrete.

 

I have a table called gifts with 3 fields: kind - offer - count

Kind and offer may have value from a list

 

the kind list is "house car plane tricycle"

the offer list is "pay win lease" 

 

I wish to automatically calculate the value of count once selected both kind and offer.

Count should be the number of records having the same value of kind and offer.

 

 

I have tried to achieve so all the afternoon yesterday but even if this it seems to me a very simple thing I cannot figure out how to make it work.

 

Thanks everyone for helping solving my issue.

Link to comment
Share on other sites

I am afraid you haven't added anything new. I can answer your question as asked, but I have serious doubts if that's the best way to achieve [whatever this is supposed to achieve].

 

 

If you define a self-join relationship of your Gifts table as:

 

Gifts::Kind = Gifts 2::Kind

AND

Gifts::Offer = Gifts 2::Offer

 

you can then make Count a calculation field (Result is Number, Evaluate from the context of [Gifts]) =

Count ( Gifts 2::Kind )
Link to comment
Share on other sites

This topic is 2845 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
 Share

×
×
  • Create New...

Important Information

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