>>>>If you have seen this in another section, I am sorry. I posted into the wrong category.
>>>>
>>>>I have generated crosstab cursor, ready for reporting. But since the fields are created by VFPXTAB, I won't know exactly what fields are created. Without knowing exactly what fields I have, how do I write the report?
>>>>
>>>>Is there a good way or do I have to make a fix column table and insert data into it?
>>>
>>>You have two options:
>>>1. Open resulting cursor and see what field names inside.
>>>2. Run one more step to rename all fields into nicer ones, using e.g. Select..Into Array and Insert into ... from array...
>>
>>Sorry, I don't understand the first option. After my program sees the field name, how do I write it into the reports? What do I put in my report during design time?
>>
>>Thx
>
>First option is applied if you have static situation, i.e. column identifier is always the same (e.g. jan,feb,etc.). In this case, you always have the same field names, and just check them once from command window. If it's not the case, then use option two.
There is a 3rd option. Write a function and call it from you XTAB cursor which gives nice field names
SELECT CUSTNAME, MYFUNC(DATE), SUM(AMOUNT) AS AMOUNT;
FROM SALES;
GROUP BY 1,2;
ORDER BY 1,2;
INTO CURSOR MYCURS
DO VFPXTAB ETC ETC
FUNCTION MYFUNC
LPARA dDATE
CASE DATE = SOMETHING
RETURN SOMETHING
CASE DATE = SOMETHING_ELSE
RETURN SOMETHING_ELSE
DO CASE
now you know your fields, so use them in your reports.
Regards,
Abdul Ahad
ENDCASE