Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Coding a MOD9 formula
Message
 
 
À
05/09/2012 11:06:33
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01552174
Message ID:
01552411
Vues:
56
>>>Actually I was just trying this code and keep getting "Operator/operand type mistmatch":
>>>
>>>
proIn = 61227660  &&RLCA
>>>
>>>lnDigit = m.proIn - (INT(m.proIn / 9) * 9)
>>>		chkdig = 9 - lnDigit
>>>		
>>>??proIn + chkdig+CHR(13)+CHR(10)
>>>
>>>It must have something to do with the proIn field because the chkdig is generated fine by itself.
>>
>>You are combining numerics and characters (CHR()) in the last line of your code
>>
>>Regards,
>>Pieter
>
>Ok, at first I thought I was getting the same error when I actually tried running the page instead of just the code, but I see they're different.
>
>When I run the server and actually try to use my page I created for this code, I get this error:
>
>Error Number: 9
>Error: Data type mismatch.
>
>The actual code:
>
>
>FUNCTION ReturnChkDig( ProIn, ValidNo )
>ProIn = ALLTRIM(ProIn)
>CASE validNo = 12 && RLCA
>		lnDigit = m.proIn - (INT(m.proIn / 9) * 9)
>		chkdig = (INT(9 - lnDigit))
>
>OTHERWISE
>		chkdig = " "
>				
>	ENDCASE  
>		RETURN TRANSFORM(chkdig)
>ENDFUNC
>
>
>There are multiple cases, but this is the only one not working.

You can not change type of the expression in the case statement. In the top chkdig is numeric and in the second statement it's character. It should be either character in both or numeric in both.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform