Count number of items in a list

I have a weekly call report database where salespeople keep track of customer contact - either a visit or phone call. Starting on Sunday and continuing until Saturday of that week, the salesperson must indicate, from a radio button - up to 5 entries for each day, whether they made a Call or Visit.

The sales director would like a weekly total for calls or visits. I cannot figure out how to count all occurrences of Visit and all Phone occurrences. I was trying to use @Element but that didn’t give me what I was looking for. Can anyone point me in the right direction?

Thank you.

Anita

Subject: Count number of items in a list

Are your days (Sunday through Saturday) separate fields on the document or is each day a separate document?

Subject: RE: Count number of items in a list

Easiest way if each “sales call” is a document would be to create a column in a view w/ a value of 1 - and then let the view do the totals (second tab of the properties dialogue box) - if it is one document for the week, w/ several fields (yikes)- use some type of # field ( @if(callmade;1;“”) (errorcheck it, since it won’t like the null) and do an @sum(field1:field2 …etc)

Subject: Count number of items in a list

How are the radio buttons setup? Do the sales people record the 5 entries on seperate radio buttons on the same document, or are there multiple documents, each with one radio button indicating a call or visit?

Subject: RE: Count number of items in a list

Thank you for the responses. One document will be created for each week. For each day, the salesperson documents the Company Name and uses a radio button for either Visit or Phone. They can have up to 5 entries for each day. So there could be a total of 45 visits or phone calls (5 entries for each 7 day week).

I hope this clarifies my earlier question. Thank you.

Anita

Subject: RE: Count number of items in a list

ok, then if i understand correctly, there are 45 radio button fields on this “weekly” document?

If that’s the case, then i hope they are named something like “name_1”, “name_2”, “name_3” etc…

If that’s true, you can iterate through the values using LotusScript, or if you’re more comfortable with Formula, then create 2 computed fields, one will hold the “visit” values and the other the “phone” values…

The “CountVisits” fields can have a computed formula like:

total :=@Sum(@If(name_1=“visit”;1;0);

                 @If(name_2="visit";1;0);

                 @If(name_3="visit";1;0);

…and so on, for all of the radio button fields, up to:

                 @If(name_45="visit";1;0))

This should give you the total radio buttons marked as “visit” (or whatever your keyword is)

The other field would do the same thing, but count “Phone” instead of “visit”…

Yes, this is not the most efficent code, but it should get the job done, that is, if the form is setup like i suspect it is.

Let me know if this helps

Regards

Subject: RE: Count number of items in a list

Steven,

Thank you. You did understand me correctly. Each radio button field is a specific field named “moncall”, “moncall_1”, “moncall_2”, etc. I was going in the direction that you mention but I didn’t know if that would be too cumbersome. As you mention though it may not be pretty but it will get the job done.

Thanks for your help!

Anita

Subject: RE: Count number of items in a list

Still a little unclear :frowning:

But let’s make some assumptions. Since all data is stored within one document you presumably have a total of 45 radio buttons, perhaps named:

ContactTypeMonday1

ContactTypeMonday2

ContactTypeMonday3

ContactTypeMonday4

ContactTypeMonday5

ContactTypeTuesday1

etc.

If this is the case, then you could have a big long formula something like:

@If(ContactTypeMonday1 != “”; 1; 0) +

@If(ContactTypeMonday2 != “”; 1; 0) +

@If(ContactTypeMonday3 != “”; 1; 0) +

@If(ContactTypeMonday4 != “”; 1; 0) +

@If(ContactTypeMonday5 != “”; 1; 0) +

@If(ContactTypeTuesday1 != “”; 1; 0)

etc.

The result of this formula could be stored within a computed field on the document.

Subject: RE: Count number of items in a list

I’m w/ Cesar - except I think if I read your post correctly, you are trying to distinquish between visit and phone- so…you would need an even longer formula-

@if(contactTypeMonday1=“1”;1 etc

and

@If (ContactypeMonday1=“2”;1 going to two separate computed fields= one for phone, one for visit.

Subject: RE: Count number of items in a list

I should say I made an assumption that behind the key word field you used alias’ - phone|1 visit|2

Subject: RE: Count number of items in a list

Yeah - I wasn’t sure about that. Anita’s original posting wasn’t clear on that part either, i.e.

“The sales director would like a weekly total for calls or visits. I cannot figure out how to count all occurrences of Visit and all Phone occurrences.”

I interpreted the “or” in the statement above as inclusive rather than exclusive.

Well, anyway, she now has a choice of which to use :slight_smile: