-Collapse +Expand
Paradox
Search Paradox Group:

Advanced
Paradox To/From
To/FromCODEGuides
Paradox Store
PRESTWOODSTORE

Prestwood eMagazine

July Edition
Subscribe now! It's Free!
Enter your email:

   ► MB LobbyCorel Paradox / ObjectPAL Coding BoardParadox Graphs & Charts Topic   Print This     

Crosstab saving

Crosstab saving in Paradox Graphs & Charts topic (part of our Corel Paradox / ObjectPAL Coding group).

Quick Search: Crosstab   Crosstab saving  
Traci
 (Inactive)
Marion, AL USA
I am trying to create a push button that will run a query, create a crosstab, save the crosstab as a table and then use the new table to create a report. I have gotten to the point where I can run the query, create the crosstab BUT now I need to know how to save the crosstab and use it to create the report. Please be as specific as you can. Thanks! Now that
 Posted 24 years ago (Thread Starter)
Comment Quote
About Traci
Visit Profile
Inactive member.
Member does not subscribe to this thread.
Email Not Verified!
Once email is verified, we will review and approve the account.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #6171, 4 replies
Thread Started 5/9/2002 9:02:00 AM
View Counter=3425
Last Reply Posted 5/10/2002 6:21:00 AM)
Location=Marion, AL USA 
Joined=25 years ago   MB Posts=1  
rt
Castel, -- UK
Not wishing to sound patronizing AI, but nice to see you metaphorically back and you certainly got the bull by the horns on this one - it was the horns wasn't it?
rt :)

Thats enough of that. Ed.

 Posted 24 years ago
Comment Quote
About rt
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.
About rt

I do like my jazz and blues!


Post ID #6177 (Level 1.1)  Reply to 6171
Thread Started 5/9/2002 1:28:00 PM
View Counter=2
Location=Castel, -- UK 
Joined=26 years ago   MB Posts=687   KB Comments=1  
Most Recent Post
rt
Castel, -- UK
Hope this hasn't put Traci off, well I'd better moo-sey on now...
Now that

Thats enough of that. Ed.

 Posted 24 years ago
Comment Quote
About rt
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.
About rt

I do like my jazz and blues!


Post ID #6186 (Level 1.2)  Reply to 6171
Reply Posted 5/10/2002 6:21:00 AM
Location=Castel, -- UK 
Joined=26 years ago   MB Posts=687   KB Comments=1  
AIBreveleri
Aw, c'mon Traci, did you even look at the online help? It's right there, under "Help | ObjectPAL Reference Topics | Index | UIObject | UIObject type | action | ActionDataCommands | DataSaveCrosstab", where it says, 'Writes given crosstab to CROSSTAB.DB.' I mean, with such complete and clearly organized help as this, I don't know why we even need a support forum.

Seriously, it took me sixteen minutes to find this entry -- and I knew it was there. You won't find anything on 'crosstab' under 'save' or 'write', and looking under 'crosstab' itself does no good at all. Trying to find 'savecrosstab' in the help index doesn't work because the index locates only whole words, and the term 'savecrosstab' never appears in the help, just 'datasavecrosstab'. But you probably know all this already.

Well, anyway, to save the contents of your crosstab uiobject, you code

   <CrossTab>.forceRefresh()
<CrossTab>.action(DataSaveCrosstab)

which causes Paradox to write the current contents of the crosstab to ':PRIV:CROSSTAB.DB'.

You could then use ':PRIV:CROSSTAB.DB' as the master table in your report.

One problem you should be aware of, when basing a report on a crosstab operation: The number and names of the columns in a crosstab depends on the values in the orignal data. The crosstab contains a column for each unique value that appears in the source field selected as the 'Column' value when defining the crosstab. As the data changes, if there are no records in the source data with a particular value, the column for that value will disappear from the crosstab. Any report based on the crosstab will encounter a missing field, and will not open without error.

For example, suppose I have a table:

   SRCDATA.DB
Name A20
Class A10
Grade N

And a form with a crosstab bound to this table. The crosstab is defined as Column='Class', Categories='Name', and Summaries='max(Grade)'. Suppose further that I save the crosstab and design a report based on ':PRIV:CROSSTAB.DB'.

With the example data below, the crosstab will contain columns named Lang and Math, and the report will have columns for Lang and Math and will display records for Alice, Bob, and Carol:

        SOURCE DATA               SAVED CROSSTAB             VIEWED REPORT

Name Class Grade Lang Math Name Lang Math
---- ---- ---- ---- ---- ---- ____________________
Alice Lang 2.5 Alice 2.5 3.9
Alice Math 3.9 Bob 2.0 2.9 Alice 2.5 3.9
Bob Lang 2.0 Carol 4.0 Bob 2.0 2.9
Bob Math 2.9 Carol 4.0
Carol Math 4.0

Now suppose that Alice and Bob both drop Lang. Nobody is taking Lang at all. If I run the same program now, the data, crosstab, and report look like this, and viewing the report generates a runtime error:

        SOURCE DATA               SAVED CROSSTAB             VIEWED REPORT

Name Class Grade Math Name Lang Math
---- ---- ---- ---- ---- ____________________
Alice Math 4.0 Alice 4.0
Bob Math 4.0 Bob 4.0 Alice [UNDEFIN] 4.0
Carol Math 4.0 Carol 4.0 Bob [UNDEFIN] 4.0
Carol [UNDEFIN] 4.0

There is no simple solution to this problem. It is part of the nature of cross tabulation.

In the example above, based on students and classes, I would create a dummy student who always took every class in the catalog every semester. This would force all the columns in the catalog to appear in the crosstab. Then I would filter out the dummy student's record before reporting.

The closest thing to a general solution to the missing column problem is to scan the saved crosstab data and copy the records into a prepared empty table that has all the required fields. You would have to use scan and test for the existence of each field, because QBE or table copy will also choke on the missing column.

This probably seems like much more than you want to know about crosstabulation right now, but save this answer in your notes in case you want to come back to it.

-Al.
 Posted 24 years ago
Comment Quote
About AIBreveleri
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #6175 (Level 1.3)  Reply to 6171
Reply Posted 5/9/2002 1:09:00 PM
Location= 
Joined=25 years ago   MB Posts=286   KB Comments=8  
AIBreveleri
Actually, I thought I was milking the topic...

Al.
 Posted 24 years ago
Comment Quote
About AIBreveleri
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #6179 (Level 1.4)  Reply to 6171
Reply Posted 5/9/2002 1:53:00 PM
Location= 
Joined=25 years ago   MB Posts=286   KB Comments=8  

Revive Thread!

Add a comment to revive this old thread and make this archived thread more useful.

Write a Comment...
Full Editor
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P1165A1
Enter key:
Icon: A Post    Thread    Idea    Important!    Cool    Sad    No    Yes    Includes a Link...   
Thread #6171 Counter
3425
Since 4/2/2008
Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site: 
www.prestwood.com


©1995-2026 Prestwood IT Solutions.   [Security & Privacy]