I.T. Discussion Community!
-Collapse +Expand
Paradox
Search Paradox Group:

Advanced
-Collapse +Expand Paradox To/From
To/FromCODEGuides
-Collapse +Expand Paradox Store
PRESTWOODSTORE

Prestwood eMagazine

December Edition
Subscribe now! It's Free!
Enter your email:

   ► MB LobbyCorel Paradox / ObjectPAL Coding BoardObjectPAL Topic   Print This     

Variable with value of reserved word query

Variable with value of reserved word query in ObjectPAL topic (part of our Corel Paradox / ObjectPAL Coding group).

Quick Search: Variable   reserved   Variable value   Variable value of   reserved word  
tlegends
Portland, OR USA

I am trying to use a query in object pal to adjust inventory quantity and ran into a problem

stockNum is a string which is given the value of the current record

This works fine except when the Item number of the Item starts with a reserved word

such as when adjusting item AS120 , the query adjusts every item in the database

I have tried "~stockNum" and  `"stockNum" in the query, but that doesn't work

Any ideas would help Thanks Jim

stockNum = ItemNo
Prod.open("Product.db")
QTY = "Quantity?"
QTY.view("Quantity to add or subtract")
descr =  Description.value
if msgyesNoCancel("Adjust quantity"," Adjust quantity of "+stockNum+ ", "+descr+"??") = "Yes" then
q1 = Query
 :inet:PRODUCT.DB  | ItemNo        | OnHand         |
                                | ~stockNum | _Hand, CHANGETO _hand + ~QTY |

 Posted 22 months ago (Thread Starter)
Comment Quote
About tlegends -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #17030, 10 replies
Thread Started 2/28/2018 11:04:49 PM
View Counter=655
Last Reply Posted 3/1/2018 9:59:34 PM)
Location=Portland, OR USA 
Joined=15 years ago   MB Posts=6  
Moderator
Steven.G
Myrtle Beach, SC USA

try this.. you're putting quotes around the string.. you'd have to do the same, interactively, if there's a reserved word, an underscore, a backslash, etc..

stockNum = "\" + ItemNo + \""

Steven Green
Senior Software Engineer
Paradox Support Specialist DOS/WIN

Prestwood IT Solutions
8421 Auburn Blvd, Suite 256, Citrus Heights, CA 95610
Office: 916-726-5675 | Fax: 916-726-5676 | http://www.prestwood.com
 Posted 21 months ago
Comment Quote
About Steven.G -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #17031 (Level 2) and Parent is 17030
Reply Posted 3/1/2018 4:31:44 AM
Location=Myrtle Beach, SC USA 
Joined=39 months ago   MB Posts=325  
tlegends
Portland, OR USA

Hi Steven, Thank you for your quick response. I tried your suggestion but it didn't work. it caused the value of stockNum to be " + ItemNo +".  I did a watch on the value and at a breakpoint at q1 = Query the value is AS120.  The problem I think is the syntax how it is called in the query itself  ~stockNum.  I have tried "~stockNum"  and "\~stockNum\""  and other variations without good results

 Posted 21 months ago (Thread Starter)
Comment Quote
About tlegends -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #17032 (Level 3) and Parent is 17030
Reply Posted 3/1/2018 9:40:49 AM
Location=Portland, OR USA 
Joined=15 years ago   MB Posts=6  
Moderator
Steven.G
Myrtle Beach, SC USA

"AS120" is what would appear in the field, and the query would no longer see the operator AS

same issue you'd have, in a State field, if you typed in OR to get Oregon, or AS expecting to get American Samoa.. you have to put quotes around it

Steven Green
Senior Software Engineer
Paradox Support Specialist DOS/WIN

Prestwood IT Solutions
8421 Auburn Blvd, Suite 256, Citrus Heights, CA 95610
Office: 916-726-5675 | Fax: 916-726-5676 | http://www.prestwood.com
 Posted 21 months ago
Comment Quote
About Steven.G -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #17033 (Level 4) and Parent is 17030
Reply Posted 3/1/2018 12:48:41 PM
Location=Myrtle Beach, SC USA 
Joined=39 months ago   MB Posts=325  
tlegends
Portland, OR USA

Ok now I'm totally confused as to what the problem is.  The pushbutton method works fine on all other products updating only the one item.  With AS101 AS102, etc items, it always changes the quantity on ALL the products in the database.  I do not have any items that star with OR, TO or other reserved words

 Posted 21 months ago (Thread Starter)
Comment Quote
About tlegends -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #17034 (Level 5) and Parent is 17030
Reply Posted 3/1/2018 1:15:10 PM
Location=Portland, OR USA 
Joined=15 years ago   MB Posts=6  
Moderator
Steven.G
Myrtle Beach, SC USA

make a copy of your data table, so you can't screw it up.. using the copy, do a changeto query interactively, with "AS120" in the field, instead of just AS120.. different result?

Steven Green
Senior Software Engineer
Paradox Support Specialist DOS/WIN

Prestwood IT Solutions
8421 Auburn Blvd, Suite 256, Citrus Heights, CA 95610
Office: 916-726-5675 | Fax: 916-726-5676 | http://www.prestwood.com
 Posted 21 months ago
Comment Quote
About Steven.G -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #17035 (Level 6) and Parent is 17030
Reply Posted 3/1/2018 1:34:46 PM
Location=Myrtle Beach, SC USA 
Joined=39 months ago   MB Posts=325  
tlegends
Portland, OR USA

 "AS101" changed 1

AS101 changed all

Also tested

AH960 changed 1

 Posted 21 months ago (Thread Starter)
Comment Quote
About tlegends -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #17036 (Level 7) and Parent is 17030
Reply Posted 3/1/2018 2:07:26 PM
Location=Portland, OR USA 
Joined=15 years ago   MB Posts=6  
tlegends
Portland, OR USA

just for info here is the complete method 

var
    stockNum, QTY, descr string
    Dat Date
    Prod tcursor
    q1 query    

endvar
method pushButton(var eventInfo Event)

stockNum = ItemNo
Prod.open("Product.db")

QTY = "Quantity?"
QTY.view("Quantity to add or subtract")

        descr =  Description.value

if msgyesNoCancel("Adjust quantity"," Adjust quantity of "+stockNum+ ", "+descr+"??") = "Yes" then

q1 = Query

:inet:PRODUCT.DB  | ItemNo   | OnHand         |
                        | ~stockNum    | _Hand, CHANGETO _hand + ~QTY |

 ENDQUERY

 else endif
    IF NOT
EXECUTEQBE(q1,"PRODUCT.DB")

THEN ERRORSHOW()
ENDIF

endMethod

 Posted 21 months ago (Thread Starter)
Comment Quote
About tlegends -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #17037 (Level 8) and Parent is 17030
Reply Posted 3/1/2018 2:08:30 PM
Location=Portland, OR USA 
Joined=15 years ago   MB Posts=6  
Moderator
Steven.G
Myrtle Beach, SC USA

 "AS101" changed 1

AS101 changed all

exactly.. it's a generic issue, in the way the query parser sees the reserved words.. when you know the field has a propblem, like this one does, you generically wrap it in quotes, in queries

Steven Green
Senior Software Engineer
Paradox Support Specialist DOS/WIN

Prestwood IT Solutions
8421 Auburn Blvd, Suite 256, Citrus Heights, CA 95610
Office: 916-726-5675 | Fax: 916-726-5676 | http://www.prestwood.com
 Posted 21 months ago
Comment Quote
About Steven.G -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #17038 (Level 9) and Parent is 17030
Reply Posted 3/1/2018 2:33:28 PM
Location=Myrtle Beach, SC USA 
Joined=39 months ago   MB Posts=325  
Moderator
Steven.G
Myrtle Beach, SC USA

try it this way.. I may have partially fat-fingered the solution

stocknum = "\"" + itemno + "\""

Steven Green
Senior Software Engineer
Paradox Support Specialist DOS/WIN

Prestwood IT Solutions
8421 Auburn Blvd, Suite 256, Citrus Heights, CA 95610
Office: 916-726-5675 | Fax: 916-726-5676 | http://www.prestwood.com
 Posted 21 months ago
Comment Quote
About Steven.G -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #17039 (Level 10) and Parent is 17030
Reply Posted 3/1/2018 2:43:19 PM
Location=Myrtle Beach, SC USA 
Joined=39 months ago   MB Posts=325  
Most Recent Post
tlegends
Portland, OR USA

Excellent! That worked perfectly! Thank You

 Posted 21 months ago (Thread Starter)
Comment Quote
About tlegends -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #17040 (Level 11) and Parent is 17030
Reply Posted 3/1/2018 9:18:22 PM
Location=Portland, OR USA 
Joined=15 years ago   MB Posts=6  

Revive Thread!

Add a comment to revive this old thread and make this archived thread more useful.

Write a Comment...
Full Editor
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P1103A1
Enter key:
Icon: A Post    Thread    Idea    Important!    Cool    Sad    No    Yes    Includes a Link...   
Thread #17030 Counter
655
Since 2/28/2018

Follow PrestwoodBoards on: 


©1995-2019 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech