Sage MAS 90 and 200 Sage MAS 500 blogs Product Feedback Support Training
Reply
Super Contributor
connex
Posts: 795
Registered: 10-29-2008
0
Accepted Solution

Need UDS technique for retrieving fields from IM_PriceCode

[ Edited ]

In order to use .GetValue on the IM_PriceCode object, how to I use .Find method to position to the needed record. 

 

I've tried:

Set oPrcCde = oSession.AsObject(oSession.GetObject("IM_PriceCode_SVC"))
retVal = oPrcCde.MoveFirst()
retVal = oPrcCde.find(strPriceCodeKey)
retVal = oPrcCde.GetValue("BreakQuantity1",break_quantity_1)
where: strPriceCodeKey is defined in format of primary key
         "2" - for PriceCodeRecord
         "     " - 4 blanks for no price code
         "6655                " - 30 character item code paded on right
         "01" - AR Customer Division
         "ABF                          " - 20 character Customer Number paded on right



 

Dan Burleson
Sage Authorized Consultant - Ask me about advanced scripting!
e-mail me here
Sage Employee
smalm
Posts: 50
Registered: 11-12-2008

Re: Need UDS technique for retrieving fields from IM_PriceCode

A couple of things:

 

The MoveFirst() method does just that, sets the pointer to the first row in the table and reads it.  You can then do GetValue() on the different columns but it will be for the first row.

 

The Find() method is used to find a row and has the same effect as using the SetKey() method within a service object.  SetKey() has one additional purpose in a _bus object in that it will allow the establishing of a new row and will result in a return value of 2 in that case. (_svc objects can only be read, so Find() and SetKey() are the same, either it finds it (return value = 1) or it won't find it (return value = 0).

 

When working with a table with multiple columns that make up the key (like this one), in order to find a row, you need to do individual SetKeyValue(<column>, <value>) calls for each key column, followed by either a SetKey() or Find() call with no arguments.  This will take the individual columns and construct the necessary composite key to find the row.  The only time you can call Find(<keyValue>) or SetKey(<keyValue>) is if there is a single column that makes up the key.

 

Hope this helps

Super Contributor
connex
Posts: 795
Registered: 10-29-2008
0

Re: Need UDS technique for retrieving fields from IM_PriceCode

Thanks for putting me back on the peak of the wave...

Dan Burleson
Sage Authorized Consultant - Ask me about advanced scripting!
e-mail me here
Super Contributor
connex
Posts: 795
Registered: 10-29-2008
0

Re: Need UDS technique for retrieving fields from IM_PriceCode

[ Edited ]

I hope you're still following this thread Steve, because I need some help.

 

I am finding that for the KPRIMARY key of IM_ItemCost (ItemCode, WarehouseCode, TierType & GroupSort) the technique you describe in this thread (which has always worked) fails when the GroupSort value consists of a numeric string.

 

Easy to check in the ABC company in I/M Maintenance for item 2480-8-50 (this is a button script)

 

Set oItemCost = oSession.AsObject(oSession.GetObject("IM_ItemCost_bus")) 

retVal = oItemCost.SetKeyValue("ItemCode$", "2480-8-50")
retVal = oItemCost.SetKeyValue("WarehouseCode$", "000")
retVal = oItemCost.SetKeyValue("TierType$", "3")
retVal = oItemCost.SetKeyValue("GroupSort$", "101")
retVal = oItemCost.SetKey()

 

Works with Lot No's JAN10, MAR10, but fails on 101 and 10210.  If I duplicate lot 10210 as A0210 it also works.

 

How does one force the construction of this key to use the given string for GroupSort?

Dan Burleson
Sage Authorized Consultant - Ask me about advanced scripting!
e-mail me here
Moderator
khmackall
Posts: 223
Registered: 10-16-2008

Re: Need UDS technique for retrieving fields from IM_PriceCode

Dan,

 

Please see my reply to your post of this issue on the Business Object Forum.

 

Thanks,

Kent