Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Many to 1 page
Message
From
09/09/2015 09:26:40
 
 
To
09/09/2015 01:50:08
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01624384
Message ID:
01624393
Views:
63
I'm going to do that. Somehow I thought I remembered doing this a while back in some really slick way.


>>I cannot remember how years ago I used to do the following:
>>
>>I have a cursor with X records, let's say 50. The report form needs to be 1 page exactly to fit a government mandated format. Each of those 50 items will appear somewhere on the page, depending on 3 fields contents. I cannot crosstab it.
>>
>>It is NOT a multi-band report. Each field on the report form could pull its data from anywhere within the 50 records, and there is no logical sorting that could put them in any sensible order. As each field on the report has to retrieve data, it has to check 3 fields and if matchs 3 fields write the value of a fourth field.
>
>You could use a UDF:
>
>FUNCTION MyUDF
>
>LPARAMETERS ;
>    SourceColumnName ;
>    , TestFieldVal1 ;
>    , TestFieldVal2 ;
>    , TestFieldVal3
>
>LOCAL ;
>    lnSelect ;
>    , luRetVal
>
>m.lnSelect = SELECT( 0 )
>
>SELECT ;
>    SourceColumnName AS MyResult ;
>    FROM MyCursor ;
>    WHERE TestField1 = TestFieldVal1 ;
>        AND TestField2 = TestFieldVal2 ;
>        AND TestField3 = TestFieldVal3 ;
>    INTO CURSOR Result
>
>m.luRetVal = Result.MyResult
>
>USE IN Result
>
>SELECT m.lnSelect
>
>RETURN m.luRetVal
>
>* The expression for each report field would be a MyUDF() call.
>
>* The above is fairly general. If you have only one column in your report source cursor then you wouldn't have
>* to pass the column you want to seek in. You could delete the SourceColumnName parameter
>
Previous
Reply
Map
View

Click here to load this message in the networking platform