Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Works in Command Window but not when running form
Message
 
 
À
02/12/2014 18:17:43
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01611698
Message ID:
01611711
Vues:
59
>>>I have the following query
>>>Select csrBOM_1.*, pUniq_Key As Assy_uniq, pAssyNo As assy_no, pAssyRev As Assy_Rev, pAssyDesc As Assy_Desc, ;
>>>				pCustAssy As Cust_Assy, lnLevel As nLevel, pUniq_Key As Bom_Parent ;
>>>				FROM csrBOM_1 Where (PART_SOURC IN('PHANTOM', 'MAKE')) Or ;
>>>				(PART_SOURC = 'MAKE' And PHANT_MAKE) Into Cursor csrBOM_Two Readwrite
>>>
>>>When it runs in a compiled app it gives an error "Function Arguement value, type, or count is invalid"
>>>
>>>If I run the application in VFP and put it in Debug mode it will error when that line is encountered
>>>
>>>If I cut and paste the line into the command window it executes properly.
>>>
>>>I changed the query to
>>>Select csrBOM_1.*, pUniq_Key As Assy_uniq, pAssyNo As assy_no, pAssyRev As Assy_Rev, pAssyDesc As Assy_Desc, ;
>>>				pCustAssy As Cust_Assy, lnLevel As nLevel, pUniq_Key As Bom_Parent ;
>>>				FROM csrBOM_1 Where PART_SOURC IN ('PHANTOM', 'MAKE') Or ;
>>>				(PART_SOURC = 'MAKE' And PHANT_MAKE) Into Cursor csrBOM_Two Readwrite
>>>
>>>( Removed a set of parens and added a space after the IN parameter)
>>>
>>>and now the query runs in the app and command window.
>>>
>>>Is there something about the extra parens and/or the missing space that could cause this?????
>>>
>>>Thanks........Rich
>>
>>Is lnLevel a variable?
>>
>>Also, your where doesn't make much sense as it's written. I think it should be
>>
>>Where PART_SOURC='PHANTOM' Or ;
>>				(PART_SOURC = 'MAKE' And PHANT_MAKE)
>>
>>assuming that the second column is logical. Are you sure phant_make is logical column?
>
>Thanks for the response.
>
>Apparantly sense (like readability) is in the eye of the beholder. I think the extra parens are merely redundant.
>But they do serve to clearly indicate the full expression on the left side of the OR.
>

You do not understand me and I really need to run now, but anyway.

Your expression is:

myCol in ('Val1', 'Val2') or (myCol='Val2' and someLogicalCol)

--------------------------

That expression is contradictory as the first one is less restrictive than the second. If myCol = 'Val2' it's true and so there is no point to check the logical value.

I assumed you wanted either val1 or (val2 only when some logical condition is true).

Or may be you want: myCol is one of the values (1 or 2) or it doesn't matter what myCol is but if someLogicalCol is true, give me these records.

So, please explain your conditions in English and remove ambiguity.


>Besides, an extra set of parens shouldn't make any difference
>
>SELECT * FROM myTable WHERE ((((somefield = somevalue))))
>
>works as long as the parens properly match up. Which they do.
>
>I'm sure phant_make is logical. If it weren't, the query wouldn't work when executed in the command window. For that matter,
>if the parens mattered the query shouldn't work in the command window either.
>
>Ugly it might be..........but in the command window it worked while when running the form it didn't.
>
>Removing the paren and adding the space after the IN made it work in both places.
>I have no idea why that should be and was hoping somebody could give me a reason.
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