Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Bizarre crashing problem
Message
 
 
À
25/10/1999 13:51:45
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00281059
Message ID:
00281096
Vues:
14
Ah, no. The extra 0's are formatting, but not the comma. For some strange reason, without the 0's priceper ends up being a width of 1, even though amount is never 0.

Now that that mystery is solved, any ideas why this is crashing?

Thanks,

Michelle


>Hi Michelle,
>
>See my reply to Sylvain. What was throwing me was the 0,000.00. Since this was dealing with a Currency data type, I was reading that as formatting.
>
>Sorry :-(
>
>>What are you talking about? The IIF has 3 parts:
>>
>>1. netwgt=0
>>2. 000.00
>>3. ROUND(MTON(amount)/netwgt,2)
>>
>>1 is the IF, 2 is the TRUE, 3 is the FALSE.
>>
>>Michelle
>>
>>
>>
>>>Hi Michelle,
>>>
>>>No there isn't.
>>>
>>>IIF(netwgt=0,000.00,ROUND(MTON(amount)/netwgt,2)) AS priceper
>>>
>>>Reads as:
>>>IF netwgt = 0
>>>   ROUND(MTON(amount)/netwgt,2))
>>>ELSE
>>>   ???
>>>ENDIF
>>>
>>>
>>>
>>>
>>>
>>>
>>>>Sure there is.
>>>>
>>>>IF netwgt = 0
>>>> priceper = 000.00
>>>>ELSE
>>>> priceper = ROUND(MTON(amount)/netwgt,2)
>>>>ENDIF
>>>>
>>>>
>>>>I'm not sure what you're seeing that I don't. It looks fine to me... And runs just fine the first time.
>>>>
>>>>Thanks,
>>>>
>>>>Michelle
>>>>
>>>>
>>>>
>>>>
>>>>>Michelle,
>>>>>
>>>>>But it's unbalanced... There is no "what to do if False" side of the equation.
>>>>>
>>>>>>>
>>>>>>>I don't know if it's "the" problem, but your priceper logic is flawed. It states:
>>>>>>>
>>>>>>>IIF(netwgt=0,000.00,ROUND(MTON(amount)/netwgt,2)) AS priceper
>>>>>>>
>>>>>>>So, if netwgt is not 0 (and what the heck is that comma doing there?) then what is priceper?
>>>>>>>
>>>>>>
>>>>>>priceper is ROUND(MTON(amount)/netwgt,2). The amount divided by the new weight rounded to 2 decimals.
>>>>>>
>>>>>>Which comma are you talking about? The first two are part of the IIF and the last one is for the ROUND.
>>>>>>
>>>>>>The IIF is just to prevent a divide by 0 error. I have this same code on a different SQL and it works fine without crashing. In fact, the whole SQL is the same except it uses totamt instead of lnAmount.
>>>>>>
>>>>>>Thanks,
>>>>>>
>>>>>>Michelle
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>I have this code:
>>>>>>>>
>>>>>>>>
>>>>>>>>SELECT Argltr
>>>>>>>>SUM amount TO lnAmount FOR (LEFT(glcode,1) $ "DGN") AND (BETWEEN(invdate,pdBegin,pdEnd))
>>>>>>>>
>>>>>>>>SELECT "X" AS metal, company, amount, netwgt, IIF(netwgt=0,000.00,ROUND(MTON(amount)/netwgt,2)) AS priceper, ;
>>>>>>>>       IIF(lnAmount=0,000.00,ROUND((MTON(amount)/lnAmount)*100,2)) AS percsale ;
>>>>>>>>FROM argltr  ;
>>>>>>>>INTO CURSOR ccstc ;
>>>>>>>>WHERE (LEFT(glcode,1) $ "DGN") AND (BETWEEN(invdate,pdBegin,pdEnd)) ;
>>>>>>>>ORDER BY amount DESC
>>>>>>>>
>>>>>>>>pcTitle = "TORRANCE CASTING INC."+CHR(10)+ ;
>>>>>>>>          "CORP. SALES TO CUSTOMER"+CHR(10)+ ;
>>>>>>>>          "BY SALES $$"+CHR(10)+ ;
>>>>>>>>          "FOR "+DTOC(pdBegin)+" THRU "+DTOC(pdEnd)
>>>>>>>>
>>>>>>>>REPORT FORM (gc_adrvprg+"ccstc") TO PRINTER PREVIEW
>>>>>>>>
>>>>>>>>
>>>>>>>>When I run it the first time, it runs fine. But if I run it again, it crashes on the SQL SELECT. If I comment out the report call, I can run it over and over with no problems. But as soon as that report runs, the next time it hits the SQL, it crashes. By crashes, I mean crashes VFP.
>>>>>>>>
>>>>>>>>I don't have a clue what could be wrong. Any ideas?
>>>>>>>>
>>>>>>>>Thanks,
>>>>>>>>
>>>>>>>>Michelle
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform