Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9080

Re: Crystal XI R2 export to .csv

$
0
0

hi Dick,

 

not sure if Partner1, Partner2 etc are actually different fields in your db...if they are then consider writing your report off of a Command object using 4 different UNION ALLs.

 

as an example, in the following i've got 4 different fields that the UNION ALLs will be treating as a single field, Field1. this would be similar to what you would do with the four different partner fields.

 

when i create a report off of this, i only need the one details line and when i export the data to csv, everything ends up in its original column as the export doesn't move anything around.

 

i've used a CSTR on the amount field as well so that the following 3 lines will have a NULL for the amount.

 

-jamie

 

 

SELECT
`Orders`.`Order ID`,
CSTR(`Orders`.`Order Amount`) AS Amount,
`Product`.`Product Name` AS Field1
FROM   (`Orders` `Orders` INNER JOIN `Orders Detail` `Orders_Detail` ON `Orders`.`Order ID`=`Orders_Detail`.`Order ID`)
INNER JOIN `Product` `Product` ON `Orders_Detail`.`Product ID`=`Product`.`Product ID`

 

UNION ALL

 

SELECT
`Orders`.`Order ID`,
'' AS Amount,
`Product`.`Color` AS Field1
FROM   (`Orders` `Orders` INNER JOIN `Orders Detail` `Orders_Detail` ON `Orders`.`Order ID`=`Orders_Detail`.`Order ID`)
INNER JOIN `Product` `Product` ON `Orders_Detail`.`Product ID`=`Product`.`Product ID`

 

UNION ALL

 

SELECT
`Orders`.`Order ID`,
'' AS Amount,
`Product`.`Size` AS Field1
FROM   (`Orders` `Orders` INNER JOIN `Orders Detail` `Orders_Detail` ON `Orders`.`Order ID`=`Orders_Detail`.`Order ID`)
INNER JOIN `Product` `Product` ON `Orders_Detail`.`Product ID`=`Product`.`Product ID`

 

UNION ALL

 

SELECT
`Orders`.`Order ID`,
'' AS Amount,
`Product`.`M/F` AS Field1
FROM   (`Orders` `Orders` INNER JOIN `Orders Detail` `Orders_Detail` ON `Orders`.`Order ID`=`Orders_Detail`.`Order ID`)
INNER JOIN `Product` `Product` ON `Orders_Detail`.`Product ID`=`Product`.`Product ID`


Viewing all articles
Browse latest Browse all 9080

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>