Focal Point
[CLOSED] How calculate the sum for two tables

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/1717002136

June 01, 2013, 04:56 AM
santu
[CLOSED] How calculate the sum for two tables
Hi All,

I am having two tables in one FEX file like below.

SQL SQLORA PREPARE SQLOUT FOR
-INCLUDE app/tshares_bal1.sql
END
TABLE FILE SQLOUT
PRINT
SEQUENCENUMBER
SHAREAMOUNT
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF OPEN
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = endeflt,
$
ENDSTYLE
END


SQL SQLORA PREPARE SQLOUT FOR
-INCLUDE app/tshares_prf.sql
END
TABLE FILE SQLOUT
PRINT
PROCESSDATE
AMOUNT
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF CLOSE
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = endeflt,
$
ENDSTYLE
END

Now i need to calcualte the total of SHAREAMOUNT column of first table and AMOUNT column of second table and need to display this total at the end of second table.

How to solve this?
can anyone please help me?

Thanks in advance.......

This message has been edited. Last edited by: <Kathryn Henning>,


Web FOCUS 7.7.03
PDF
June 01, 2013, 08:00 AM
FrankDutch
Many ways to skin a cat, but I would in this case create an union query on the SQL part.
Then you have all the data in on report.

Of course the fields need to have the same name and format. And you might want to add a resource code to the two parts.

Of course you also can do this after you selected the data with SQL
In that case you in fact create a 3th report With the sum of both data sets.

In that case I would put the 2 data sets first in 2 different hold files.

But I am sure you will come up with aditional questions.
To much to explane in one single answer.

How about some basic training.?




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

June 01, 2013, 08:10 AM
santu
Hi FrankDutch,

I am new to webfocus. I didn't got any basic training.

My two tables having different types of columns.
I will merge the two SQL queries into one.

After that how to seperate the datesets into two hold files and do the sum calculation.

I am doing this for PDF reports. Here one more problem, two tables should come in one page like appending one table after another.In this case your idea will work.

Can you please provide me some rough code in the form of steps.


Web FOCUS 7.7.03
PDF
June 02, 2013, 12:58 PM
FrankDutch
Step one

Try to get some training

Step two

Study the databases that are mentioned in the manuals, like the CAR table. Many examples are made on that table

Step three

I would recommend to create masters for these database tables if you need to build reports more then once.
Then you can rename and reformat the fields so they are the same.
You can add a defined field to both tables like Tblname and give them a basic.
Now you can create a report based on these two tables as if it is one table
And you still have because of the table name a way to split the report in two separate subtotals and an overall total.

Step ...

Good luck..




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

June 03, 2013, 09:13 AM
J
Santu, I see you are new to the forums and focus in general. I also see several topics in a row with your name. Training is great and will save you a lot of time.

Also, you DO have time to read up on the documentation, trust me. Although the members of this forum are great and quick to respond, they have their work too. Sometimes you may not get a response for a couple of days. Looking up something in the documentation usually only takes a minute (especially if you are familiar).

We are here to help, not to do your work. When I started off, I didn't receive training off the bat either. Instead I toyed around, read the documentation, and read through many of the previous posts already in these forums that answered many of my questions. I didn't post a question until after several months in FOCUS.


WebFOCUS 7.7.03/8.0.08
Dev Studio 7.7.03/8.0.08
App Studio 8.0.08
Windows 7
ALL Outputs
June 04, 2013, 01:41 PM
santu
Sorry for this.

I will follow your path.

Thankyou............


Web FOCUS 7.7.03
PDF