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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL question regarding Pivot Tables

Status
Not open for further replies.

ACCESSDUMMY

Programmer
Oct 22, 2003
33
US
Is there a way in Paradox to create a query that will result in a answer table that has a certain field's data as the answer table's field names.

For example,

Table1.db has the fields "Date", "Employee Name" and "Amount".

I'd like to query the "Employee Name" so that my answer table has the following fields:

"John Doe"
"Sue Smith"
"Michael Jones"

Any help would be greatly appreciated?
Thanks!
 
AccessDummy,

While not directly the same as Access's pivot tables, Paradox provides a Crosstab object for forms and reports. You can save crosstab results to a table by:

1) Creating a form that creates the crosstab

2) Adding code to save the contents of the Crosstab object to a CROSSTAB table in your private directory.

Assuming your form is called MyXtab and it contains a Crosstab object named Crosstab1, the following code may help get you started:

Code:
var
   fmXTab  Form
   uiXTab  UIObject
endVar

   if not fmXTab.open( ":WORK:MYXTAB" ) then
      errorShow( "Can't Open Form", 
                 "Use >> button for details..." )
   else
      uiXTab.attach( fmXTab, "Crosstab1" )
      uiXTab.postAction( dataSaveCrosstab )
      sleep()
      fmXTab.close()
      Message( "Crosstab information saved to :PRIV:CROSSTAB.DB..." )
   endIf

This would go in a the pushButton event of a button or in the run event of a script.

Hope this helps...

-- Lance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top