Hot Topic (More than 10 Replies) Posting costs from PO to Inventory records (Read 1328 times)
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Posting costs from PO to Inventory records
Feb 27th, 2009 at 6:48am
Print Post Print Post  
Parent "Purch", subform "POLines" .  When placing PO's (which consist of multiple line items ordered on the same PO to a vendor), I would like to have POLines!ItemCost  posted to the Inventory!ItemCurrentCost  field as each line item is placed with the vendor and the current cost confirmed.  So that any sales orders or quotes or pricing updates done subsequently during the day gets the benefit of up-to-the-minute cost info.

I have a field in my POLines subform - POLinesYN, which is a yes/no field.  When the line item is placed with the vendor, I enter a "Y" in this field to show that the line item was not only intended to be ordered, but has in fact been ordered.  My thinking was that 'on element change' would be the trigger that fired the XPOST.  Is this a good idea, or should I approach this a different way?

Here is my attemped code which is not working
if ((@Mode() = 1) or (@Mode() = 0)) and (@isBlank(POLinesYN) = 0)
           {
                 XPOST(@fn, ItemNum, "Inventory!ItemNum", ItemCost, "Inventory!ItemCurrentCost", "")
           }
  

Larry
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Posting costs from PO to Inventory records
Reply #1 - Feb 27th, 2009 at 8:07am
Print Post Print Post  
xResultSetValue ( ) command is a lot more efficient. It posts directly to database.  Sooner you acquaint yourself with xResultSet commands, better it would be for you.  Eventually I replaced most of my xpost and xlookups with xResultset ( ) commands.  They are so much faster and can be used for reports and opening forms also.
  
Back to top
 
IP Logged
 
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Re: Posting costs from PO to Inventory records
Reply #2 - Feb 27th, 2009 at 1:47pm
Print Post Print Post  
Hi Bharat,

Yes, I've been studying the XResultSetValue command, but am having a little trouble with the syntax.   My thinking was that I'd tryout the XPOST command (since I'm more Q&A familiar with the 'Post' concept) on a few practice records just to make sure I had the concept down pat between the fields of the two databases (POLines!ItemCost and Inventory!ItemCurrentCost). Once I got that to work, then I would start experimenting with XRSV and implement it in subsequent code.   But I can't get the POLines!ItemCost to post/replace the Inventory!ItemCurrentCost.  I'll keep at it.
  

Larry
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Posting costs from PO to Inventory records
Reply #3 - Feb 27th, 2009 at 5:27pm
Print Post Print Post  
I have created my own syntax file for Sesame commands, and here is what I have for XPOST:
XPOST ("filename", source key,"[formName!]target key", source element, "target element","[operation]")

The name of the form is already identified in the third parameter.  Try removing the name of the form from the target element, only need the element name:

From:  XPOST(@fn, ItemNum, "Inventory!ItemNum", ItemCost, "Inventory!ItemCurrentCost", "")

To:      XPOST(@fn, ItemNum, "Inventory!ItemNum", ItemCost, "ItemCurrentCost", "")




  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Re: Posting costs from PO to Inventory records
Reply #4 - Feb 27th, 2009 at 7:16pm
Print Post Print Post  
thanks Bob!  I'll give it a try right now (on my way to lunch, but this is worth a few bites of tuna!)
  

Larry
Back to top
IP Logged
 
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Re: Posting costs from PO to Inventory records
Reply #5 - Feb 27th, 2009 at 7:25pm
Print Post Print Post  
still no joy, but I think I know what I'm missing.   I'm trying to post the ItemCost that's in the record I'm currently in, and I don't know how to code that I want to post THIS SPECIFIC record that is currently 'open'

regarding XRSV,
I'll study it this afternoon, but from reading last night it seems that I need to:
-  declare a vRShandle, and then
- have it equal the open record field, and then
- put that value to the Inventory cost field?

am I on the right track?
  

Larry
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Posting costs from PO to Inventory records
Reply #6 - Feb 27th, 2009 at 7:58pm
Print Post Print Post  
How are you triggering the XPOST oommand?

XPOST(@fn, ItemNum, "Inventory!ItemNum", ItemCost, "ItemCurrentCost", "")  should take the ItemCost value from the current record and place it into the ItemCurrentCost element in the InventoryItem database where the ItemNum value matches the ItemNum value of this record.  Make sure that both databases have the same data types for the matching elements.

This should work on every record in a Mass Update
It should work on each record if OnFormExit which is where I would probably put it.  It should be followed with commands for error checking.


Here is an approach(put in some WriteLn commands to show results):
You can get the existing value from external record before doing XPOST
Then do the XPOST
Run @ERROR command, and continue if OK
Then get the current value from external record after XPOST and confirm math/replacement was done correctly ELSE some type of Error Response programming.

  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Re: Posting costs from PO to Inventory records
Reply #7 - Feb 27th, 2009 at 9:50pm
Print Post Print Post  
got it!  It's working!   YAHOO!!!!!!!!!!!!!!!!!!!!
     this will be killer!  that means that when a po line item cost is confirmed and placed at 8:30am, the cost on that product that is visible to all others is up to the minute cost (as opposed to our current QA solution, which runs a batch post each night, so we're always a day behind).

That also means I can figure out how to program the order form to pull in predetermined prices (unique to each client) as the order is entered, but allow for on-the-fly adjustments to pricing that can then be instantly posted to the Pricing record for that client/part#.
            the above now requires about 5 steps in QA (lots of duplicated entry), and now will just 'happen' in the course of entering data one time!

Sweet!  What a great way to finish Friday afternoon!  Next time you're in Tulsa, Bob, the beer's on me.   Cheesy
  

Larry
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Posting costs from PO to Inventory records
Reply #8 - Feb 28th, 2009 at 1:29am
Print Post Print Post  
Glad to hear you are working OK.

But, remember to look at the xResultSetValue ( ) command.

Remember, you don't need to delete code in development.  You can comment out blocks of code (XPost) and try the new code (XRSV), if not working yet, then just comment out the XRSV and uncomment the XPOST to keep working.  This will allow you to pick away at new code, but still have working code for current operations.
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Re: Posting costs from PO to Inventory records
Reply #9 - Feb 28th, 2009 at 4:39am
Print Post Print Post  
yes, great point.  I will follow it.

I'll be looking at XRSV hard in the next couple weeks.  I get the concept, but haven't been able to see the picture in my head yet.

Thanks again.
  

Larry
Back to top
IP Logged
 
pineberry
Full Member
***
Offline


No personal text

Posts: 115
Location: Strawberry, AZ  USA
Joined: Nov 30th, 2002
Re: Posting costs from PO to Inventory records
Reply #10 - Mar 8th, 2009 at 11:21pm
Print Post Print Post  
I am having trouble following how to use XresultSet commands to replace XPost where I am adding or subtracting from the field I am posting to. the way I see it it requires 3 commands. One to retrieve the value, one to perform the operation and one to save it.
Am I missing something?
Harley
  
Back to top
 
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Posting costs from PO to Inventory records
Reply #11 - Mar 9th, 2009 at 12:03am
Print Post Print Post  
That sounds right for the basic functions.

See Erika's example here, look at the 7:35pm response" http://www.lantica.com/Forum3/cgi-bin/yabb2/YaBB.pl?num=1194473023/3#3
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
pineberry
Full Member
***
Offline


No personal text

Posts: 115
Location: Strawberry, AZ  USA
Joined: Nov 30th, 2002
Re: Posting costs from PO to Inventory records
Reply #12 - Mar 9th, 2009 at 12:40am
Print Post Print Post  
Thanks Bob,
Think I'll stick with my 3 statements using @XResultSetValue, math, XResultSetValue.
  
Back to top
 
IP Logged