Normal Topic code works in 2.5.0; doesn't work in 2.5.2 (Read 1114 times)
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
code works in 2.5.0; doesn't work in 2.5.2
Apr 24th, 2012 at 6:25pm
Print Post Print Post  
Just updated my office this morning to 2.5.2 from 2.5.0.  Immediately ran into a problem.  Tried about 8 different workarounds - nothing worked, so I rolled back down to 2.5.0, and all working as before today.

The code that would not work is in POLines as a subform for Purch.  ItemNum!OnElementChange" event:
IF (@Mode() = 0) or (@Mode() = 1)
     
     { //begin A

           
       vItemNum = @FormFieldValue("POLines", "ItemNum", 0)

writeln(vItemNum)

       vRS1 = @XResultSetSearch(@FN, "Inventory", SEARCH_MODE_AND, SEARCH_SYNTAX_QA, "!ItemNum=" + vItemNum)
       If vRS1 > -1
            { // begin B
           vTot = @XResultSetTotal(vRS1)
writeln(vTot)
           If vTot = 1
            { //begin C
           
           vItemDesc = @XResultSetValue(vRS1, "ItemDesc")
   ..... blah blah blah


I added the writeln's to see what was going on - vItemNum = @FormFieldValue("POLines", "ItemNum", 0) wasn't picking up the part # in ItemNum, and vTot was  3261 (all of the inventory items) instead of the "1" item that it is designed to find via vItemNum.

I tried just reading ItemNum element in my XResultSetSearch (ItemNum instead of vItemNum), and while that worked for the first part of the code (to find the itemdesc, cost, etc from Inventory record), subsequent code further down that is dependent on the variable vItemNum did not work.  Although subsequent line items did work correctly.



Any ideas? 
  

Larry
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: code works in 2.5.0; doesn't work in 2.5.2
Reply #1 - Apr 24th, 2012 at 7:17pm
Print Post Print Post  
2.5.2 fixed some focus issues with subforms. It looks like you are depending on the code to pick up whatever subform you are "on" however, since you may not have any particular subrecord focused, it doesn't get anything. You'll need to tell it which subrecord you want.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Re: code works in 2.5.0; doesn't work in 2.5.2
Reply #2 - Apr 24th, 2012 at 8:52pm
Print Post Print Post  
I thought the "0" in ("POLines", "ItemNum", 0) was saying that I want the string residing in the ItemNum element of the currently open POLines record ?

This exact same code is also in Orders!SOLines  "ItemNum!OnElementChange", and it works in 2.5.2 as it does in 2.50 , so I'm a little perplexed to what the difference is ....

v2ItemNum = @FormFieldValue("SOLines", "ItemNum", 0)
  vRS2 = @XResultSetSearch(@FN, "Inventory", SEARCH_MODE_AND, SEARCH_SYNTAX_QA, "!ItemNum=" + v2ItemNum)
   
    If @XresultSetTotal(vRS2) = 1                         // if there is exactly one matching record in Inventory, pull data from Inventory into SOLines
         {
                                                       // Get and then plug ItemDesc, Cost, UoM, Cat and issue message box to manually enter Price
       vOEMnum = ""
       vYPU = ""
       v2ItemDesc = @XResultSetValue(vRS2, "ItemDesc")
  

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



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Re: code works in 2.5.0; doesn't work in 2.5.2
Reply #3 - Apr 25th, 2012 at 2:18am
Print Post Print Post  
I got it sorted out.  Re-rolled it out (anyway, it was a good excuse to tighten up some of my clunky early code design from 3 years ago  Roll Eyes )
  

Larry
Back to top
IP Logged