Baanboard.com

Go Back   Baanboard.com > Forum > Baan Quick Support: Functional & Technical > Tools Development

User login

Frontpage Sponsor

Main

Poll
For ERP LN feature pack upgrade, what method of install are you using?
Installation Wizard into existing VRC
35%
Installation Wizard into new VRC
42%
Manual into existing VRC
3%
Manual into new VRC
19%
Total votes: 31

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 27th October 2016, 12:43
smusba smusba is offline
Senior Member
 
Join Date: Apr 2008
Posts: 173
smusba is on a distinguished road
Baan: Baan 1V - DB: Oracle 9i - OS: Windows xp
Adding previous value with new value
Baan: ERP LN 6.1 FP6
C/S: Client

Dear,

I want to do adding calculation from a previous value with the new value.
For example : line# 2 has value 'X' and line#1 has a value 'Y' I want to add both 'X' and 'Y' for more no of lines. How to program the script for this issue?
PHP Code:
Value       Pr.Value Value                        Final value
1                          1                                           1
3                          4                                           1
3
5                          9                                           4 

6                         15                                          9 
.......so on 
Reply With Quote
  #2  
Old 27th October 2016, 14:42
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 6,905
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
I guess I am not sure why you are doing something like this. I mean you just need to keep track of the last number. So if you are updating a table, find the records you want. Step thru them 1 at time, on the first record set something like oldvalue to the first record value, from then on make oldvalue = to new value + oldvalue. Write the records out.

Maybe if you explain what exactly you are trying to accomplish someone has a better idea on for a solution.
__________________
Mark

GO Cards!
My latest mantra - make sure you have latest stpapi patches and the latest session object. If on LN then please explore the option of using DAL2 functionality.

Shared Solutions for Baan systems provided free by Baan Board.
Play the Google game and help Baanboard get better rankings. Do your part. Click here to find how.
Reply With Quote
  #3  
Old 27th October 2016, 15:03
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,287
bhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura about
Baan: LN FP 1-9, 10.4, a little bit of Baan IV - DB: SQL Server 2008, Oracle - OS: Windows Server 2008 R2, Unix
Mark, it can be used for various purposes e.g. in YTD calculations where you want to show remaining balance after every transaction line.

For that, you can use report script. Store final value in a variable x. Add that to your report layout. Now, in the before.layout section of the layout you are using do curr.value+x(assuming curr.value holds the current value)

In your case it will be -

Say your layout is detail.1 and your value is X. You will do this -


Code:
detail.1:
before.layout:

      final.value = final.value + X | X will be your first column and final.value will be printed as second column

Not much of a work.
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!
Reply With Quote
  #4  
Old 27th October 2016, 15:06
Ajesh's Avatar
Ajesh Ajesh is offline
Guru
 
Join Date: Feb 2009
Posts: 444
Ajesh is on a distinguished road
Baan: LN 10.4 - DB: Oracle - OS: HP-Unix
i didnt even understand the pattern.It looks like some distorted version of Fibonacci..
Reply With Quote
  #5  
Old 27th October 2016, 16:17
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,287
bhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura about
Baan: LN FP 1-9, 10.4, a little bit of Baan IV - DB: SQL Server 2008, Oracle - OS: Windows Server 2008 R2, Unix
Quote:
Originally Posted by Ajesh View Post
i didnt even understand the pattern.It looks like some distorted version of Fibonacci..
They are just values from some table. Though if interested, here are the algorithms which define the two sequences -

For Value Column and For Final Value Column
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!
Reply With Quote
  #6  
Old 27th October 2016, 23:03
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 6,905
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Quote:
Originally Posted by bhushanchanda View Post
Mark, it can be used for various purposes e.g. in YTD calculations where you want to show remaining balance after every transaction line.
Correct - but the final solution will vary if (a) they are doing it in a table wanting to update, (b) want to do it in a form (c) doing it in a report. The calculation can be simple like you showed - and I believe it is for all 3 solutions. Just a little different on where you do the calculation. Now if they give us more details that "being simple" could become complicated.
__________________
Mark

GO Cards!
My latest mantra - make sure you have latest stpapi patches and the latest session object. If on LN then please explore the option of using DAL2 functionality.

Shared Solutions for Baan systems provided free by Baan Board.
Play the Google game and help Baanboard get better rankings. Do your part. Click here to find how.
Reply With Quote
Sponsored Links
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to perform subtraction using values of previous record sureca Tools Development 2 22nd December 2014 10:12
"error in running bdbpre" when creating sequential dumps sujitvidwans Tools Administration & Installation 5 16th February 2013 11:56
Storing previous values JRussell Tools Development 3 11th January 2003 11:47


All times are GMT +2. The time now is 04:58.


©2001-2017 - Baanboard.com - Baanforums.com