Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Transposing
Message
From
26/05/1999 18:05:00
J Chris Powell
Myers and Stauffer Lc
Kansas, United States
 
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Title:
Miscellaneous
Thread ID:
00222826
Message ID:
00223211
Views:
20
I had a tip in the January 1998 Advisor that may help. I do this all the time. It has some limitations, but the method is very useful and reliable. To summarize, if you imbed and IIF() inside a SUM() or MAX() or MIN() within a SELECT. For instance: to cross-tab sales by quarter so that for each salesman, you get the total sales by quarter,

SELECT Salesman, :
SUM(IIF(BETWEEN(Month(s.Date),1,3), S.Amount) AS FirstQ,;
SUM(IIF(BETWEEN(Month(s.Date),4,6), S.Amount) AS SeconQ,;
SUM(IIF(BETWEEN(Month(s.Date),7,9), S.Amount) AS ThirdQ,;
SUM(IIF(BETWEEN(Month(s.Date),10,2), S.Amount) AS FourthQ,;
FROM Sales S;
GROUP BY Salesman

if you dont GOUP BY , then you simply get the total sale by quarter. When you think about it, It simply catagorizes the records as it goes thru them, and sums them in the correct field, only if the statement is true. The big limitation is that you have to know the contents of the criteria field.

The tip didnt communicate as well as I intended. It stated that the listed example could get the accounts receivable aging. I had written that I was *able to get* the accounts receivable aging in two selects using this method. Hope this helps.

>Hi there! Need help. Is there a way of transposing data in foxpro? You know more or less the way you just transpose a range of data in a spreadsheet application.
>
>I would love to transpose my data into some temp cursor so that column 1 becomes the first row / header before I pull the data in a report.
>
>
>Thanks
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform