Crosstabs in Paradox can be a bit confusing--until you do a few of them. The easiest way to do this is to open the table you want to perform the crosstab on, then click on the "quick crosstab" button in your property toolbar. If you don't know which one this is, hold your cursor still over the various buttons until you find it.) This will bring up a dialog box that asks you to define the crosstab. This is the part that confuses a little. There are three "fields" in the crosstab definition that must be filled in: Column, Categories, and Summaries.
The Column will represent the fields across the top of your crosstab. So if you wanted a crosstab to show data across time or SIC code or product number or something, specify it here.
The Categories field(s) will be the first field (column) in your crosstab. So if you wanted to see a summary by retailers, this would be where you point to the RETAILER field in you table. This field will also accept multiple fields, so if you wanted to see retailers by city, you could also specify that here.
And finally, the Summaries filed is pretty much sel-explanatory. Whatever it is you want summarized to the other two field levels (like orders or sales), put it here.
You can save your crosstab as a table. You can do this manually by clicking on Edit->Save Crosstab, and it will automatically save the table as RIV:Crosstab.db.
The one thing that I had trouble finding was the ObjectPal method for automating the saving of a crosstab to a table. Just name the crosstab object by right clicking on it in the Design view in the properites dialog box (we'll call it the infamous "myCrossTab" and you can write the following method in the arrive() method on the form-- myCrossTab.action(dataSaveCrosstab)
Suppose you have the Answer to the query
Total Sales, per month, per State.
State Sort Month Sales
HI 1 Jan01 45
HI 2 Feb01 10
NY 1 Jan01 100
NY 3 Mar01 922
Your could get a crosstab to make this look more like a spreadsheet
State Jan01 Feb01 Mar01
HI 45 10 0
NY 100 0 922
This is what crosstabs do! )
In this case, (I'm a DOS man, so may be slightly different in Windows), if you use the XtabKey in the state field, it will use the end column (sales) for the data, the one next to it as the new column names and ignore the Sort.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.