• Status: Solved
• Priority: Medium
• Security: Public
• Views: 201
• Last Modified:

# How to calculate total?

I have created a form and on that form, it contains 3 product names which will varies depend on what the user enter e.g field 1 contains "Trend",field 2 contains
"Microsoft Office" and field 3 contains "Symantec".
I want to compute the above as the licenses for each product so if there are a lot of forms entered in the view, under one of the column, it will display the total licenses for each product.

I try with this formula but there's error.
temp :=  0;
@If(@Contains(product | product_1 | product_2;"Officescan");temp+1;1)

How do I achieve what I want?
0
kopibean
Asked:
• 6
• 6
• 3
• +2
1 Solution

Commented:
Add in your form an extra field (Computed)
Like TotalProducts
Give it as value Field1 : Field2  : Field3
Go to your view and add a column, the first column should have as column value 1
And in the column properties, go to the second tab and choose below under totals "Total"
Your second column is the TotalProducts column with as columnvalue TotalProducts, this column is categorized

This is all
Now you see in the first column the total of each product and the total of all the products.

Greets,
Sloeber
0

Commented:
Sloeber proposal is good, but...

even better is not to create a new form field and recalculate all documents with this form.
Simply enter the same formula as Sloeber proposed for forms field TotalProducts into second view column formula.
That means, the second column formula is:
Field1 : Field2  : Field3

Greets,
zvonko
0

Commented:
I was thinking which method I want to use.

The disadvantage of my method is that you've an extra field. And that you must write an agent with as formula @Command([ToolsRefreshSelectedDocs]).And that the size of the database is a little bit bigger.

The advantage is that if you want an overwiew also in other views, you just have to call this field and that it's not necessary to write the formula everytime.
And that if you go to a view you have in the document properties also an overview of all products in one field.
And if you write an agent which use these values that you just call this field.

Like you see, it's just a choice that you make. But it's not so important.

But it's good from zvonko to mention that it's not really necessary to add a field

Greets,
Sloeber
0

Commented:
forget it Sloeber. this 20 points are mine <|;-)

Hello kopibean,

first of all you do need no agents (hi, hi) and no view column formulas counting "temp+1"
The subtotals and grandtotal are counted by the view itself.

Here the step how to do.
Let us assume your view name is: ProductLicenses
In this view make the first column categorized and mark "ShowTwistieWhenRowIsExpandable".
For this first column value do not take a Field, but select Formula.
The Formula for this first column value is:
@Explode(@ReplaceSubstring(@Implode(product : product_1 : product_2;";");"; ;";";");";")

The implode/explode is done to get ride of this ugly "(NotCategorized)" entries for empty fields.

As second column you need a Total column.
On the property dialog of this second column select in second tab (Sorting) this entries:
Sort=None
Type=Standard
Totals=Total
HideDetailRows=checked

Save this view and look to see.
Is this wath you asked for?

Regards,
zvonko
0

Commented:
Zvonko forget it ;-),

You make it more complicate then it is.
You must make it easier
and BTW I also dont't use any agent
only for the refresh but that's only one time for the existing documents
and when you write the formula in the view and not in the form, you don't use any agent.
I repeat.

The first column should have as column value 1
And in the column properties, go to the second tab and choose below under totals "Total".
The second column has as value Field1 : Field2  : Field3
, this column is categorized
This is all. Easier isn't possible
Now you see in your first column the totals.

Greets,
Sloeber

ps : zvonko, I'll sent you 5 points because you tried to help
-----
~ c     |
~ ;-(|)=
~ c     |
-----
0

Commented:
...and in the last row you see (Not Categorized) for all empty fields in any of view documents.

It is really a pity that I go to sailing for a week to Netherlands. In other case I would waste my time with this silly jockes on EE to get crazy 20 points. Really funny ;-))

Do not wait for me to come back from sailing...

So long,
zvonko
0

Commented:
What the heck smiley is that?
0

Commented:
From: sloeber

I solved the problem myself ;-))
I simply clicked on Total, and hey, I got totals!!!

(ha, ha...)
0

Commented:
Hai Arun, how are you?
0

Commented:
to Sloeber:
-------O    //
~ c     |   //
~ ;-(|)=<
~ c     |   \\
-------O    \\

Cheers
0

Author Commented:
Hi sloeber,

I do not get what you first column should contain. You mention that it should have column value1(what is value1?).
If possible, could you email me a sample database to this address sim_friends@yahoo.com?
Thanks a lot.

To zvonko,
thanks for your efforts too but your solution makes me confused. I do not quite understand it. But thanks for responsing to my problem.
0

Commented:
hey kopibean,

Just type 1
that's all

greets,
sloeber
0

Author Commented:
Hi sloeber,

I try your suggested solution but still fails. Maybe there is a mis-interpretation on my problem.
For the view, the first column is to display the product names which is from another form. Then the second column is to display the total licenses for each product (this column value will be computed as when a product e.g "Microsoft Office 97" is entered a lot of times, then it will display the total no that Microsoft Office 97 appears in the form above.) E.g when user 1 create a form,
he enters "Microsoft Office 97" and "Access 2000". Another user creates another form(same form as user 1), he enters "Microsoft Office 97" and "Visual C++", then the column will display under "Microsoft Office 97" the value 2.

How do I achieve what I want to be display in the second column?

Pls help.
Thanks.
0

Commented:
Kopibean,

I've made an example for you.
I've send it to your emailaddress.

Greets,
Sloeber
0

Author Commented:
Hi sloeber,

I try your solution but your solution will applies if Word is entered in field 1 and no same occurence will appear in field 1. What I have is for different pcs, most of it have the same programs installed. Thus, how do I ensure that if Word appear in field 1 under pc1(entered by user 1) and Word also appear in field 1 under pc2(entered by user 2). In these situations, Word would have 2 licenses appear under the column.

How do I resolve this situation?
0

Commented:
if you make for each pc a seperate document, then your problem is solved.
else you must write an agent who makes a rapport for you with all the details

Greets,
Sloeber
0

Commented:
Thanks for the points guys!

:-)

Stamp thanks for a bigger smiley.
0

Commented:
How would this work to generate totals for each categorized entry.  Column 1 is sorted and categorized... want sub totals for each categorized entry to appear after the entries ??  Can you test the totals for the view to only display the entries where the total is > 3 say.  That way the view would show all the documents that have a categorized entry with more than 3 documents, give the total and list the entires ?!?!?!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

## Featured Post

• 6
• 6
• 3
• +2
Tackle projects and never again get stuck behind a technical roadblock.