Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CSUM IN SCRIPTS

Status
Not open for further replies.

FATSWALLER

Technical User
Sep 18, 2001
1
GB
In Paradox 3.5(groan)I am running a query as a script(I think) that uses csum to provide a total. This only totals unique values and I cannot seem to overcome this problem.
If I run a query on the same table in real time using calc sum this works fine but this does not work within the script?
Anybody know how to solve this?
 
It seems to me, I have solved this problem when set "Query order" to "Table order" in Custom Configuration Proramm. But PDOX 4.5.

 
FatsWaller,

JoeNG is correct. Both Paradox/DOS and Paradox for Windows (QBE) queries support an optional qualifier to the summary calculations: UNIQUE or ALL. They behave as you might expect:

UNIQUE (the default) only summarizes unique occurances of a value in the matching set where ALL summarizes all values.

Hope this helps...

-- Lance
 
I think that the call to CSUM is probably made after the query in the script and it is pointed at the ANSWER.DB table. In that case, you need to insure that the query uses checkplus instead of check so that you get repeating values.

Hope this helps,

Mac

old PdoxDOS programmer :)
 
Langley,

We can compare Paradox/DOS scars later. I suspect there are more stories than immediately apparent. This is typical, eh? *broad grin*

The checkplus comment is a good point, especially since it--like ALL and UNIQUE--trips up a lot of people.

By default, Checks in QBE queries return the first record that matches all values matching the selection criteria. They also sort the results according to the currently selected language order.

CheckPlus, on the other hand, returns all matches, regardless of the sort order.

In Paradox/DOS, CheckPlus is frequently preferable. In PDOXWin, well, "it depends."

Usually, I resolve these by looking at what's needed. In certain cases, non-QBE approaches may be more appropriate, e.g. tcursors combined with instantiateView(), SQL queries to tCursors, and so on.

-- Lance

P.S. And, yes, I really *do* exist.
 
Ha ha - right you are about the scars - I'm sure <smile>. When I posted to this thread I didn't see that the original poster put it up last year some time. I wonder if he'll even see the responses...

Mac

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top