Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Query problem
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
01334144
Message ID:
01334145
Views:
8
This message has been marked as the solution to the initial question of the thread.
Jon,

VFP incorrectly determines the size of the calculated field (1 digit) in the result. In VFP9 you can use CAST() function, in previous versions put as many zeros as the size of the field you want to be.
Assuming that 3 digits is enough
* VFP 9

CAST((IIF(DSPR.IsBuyOrSell = 1, DSR.DaysAccrued, 0) AS N(3)),
CAST(IIF(DSPR.IsBuyOrSell = 2, DSR.DaysAccrued, 0) AS N(3)),
* pre VFP9
IIF(DSPR.IsBuyOrSell = 1, DSR.DaysAccrued, 000),
IIF(DSPR.IsBuyOrSell = 2, DSR.DaysAccrued, 000)
>We have a query that's generating a weird result/error. Below is the sample:
>
>
>SELECT
>IIF(DSPR.IsBuyOrSell = 1, DSR.DaysAccrued, 0),
>IIF(DSPR.IsBuyOrSell = 2, DSR.DaysAccrued, 0)
>FROM Deal D
>INNER JOIN DealSide DSR ON D.SystemDealNumber = DSR.SystemDealNumber AND DSR.Side = 'R'
>INNER JOIN DealSideProduct DSPR ON DSR.SystemDealNumber = DSPR.SystemDealNumber AND DSPR.Side = DSR.Side
>INNER JOIN SystemParameters SP ON (1=1)
>WHERE EMPTY(D.OptionExpiration) AND D.Approved AND D.TerminationDate >= SP.LastDailyProcessing
>      AND ! INLIST(D.Product, 'SWAP', 'CAP', 'EQUITYOPTION')
>ORDER BY Grouping1 ASC, DealNumber ASC
>
>
>The second field is generating an error. When run in VFP itself, an asterisk appears as the value. When we run the select statement with only the second field, the query result is exactly as expected. If we change the second field to have 100 as the else value instead of 0, then it works. What could be causing this to happen?
>
>
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform