computed column referencing previous row

I suppose this is basic but I don't have much experience:


I want to do this in a datawindow:
(based in a table with the "article", "in" and "out" information)

***********************************
Article: xxxxxxxx  

   In    Out    Balance
  ----   ---    -------
  10              10 
          3          7
          2          5
  15              20
          1        19
                 ------
    Balance:  19
***********************************


How can I make the "Balance" work ?
I try a computed field but I don't know how to reference a value 
of a previous row. 

Is is possible ? 

I see that the getrow() function is available defining a computed column. 
I possible use it to get the value of a previous row ?


Thanks in advance,
	                      Horacio.-


----------------------------------------------------
Horacio Judeikin
HoracioJ@bufalo.coasin.com.uy

0
Horacio
7/23/1997 7:10:27 PM
sybase.powerbuilder.datawindow 28057 articles. 4 followers. Follow

4 Replies
927 Views

Similar Articles

[PageSpeed] 44

Horacio,

columnname[-1] will get you the value of the previous row.

Mark

Horacio Judeikin <HoracioJ@bufalo.coasin.com.uy> wrote in article
<01bc97a4$d8d06ce0$177f03cf@TheGuest.adinet.com.uy>...
> I suppose this is basic but I don't have much experience:
> 
> 
> I want to do this in a datawindow:
> (based in a table with the "article", "in" and "out" information)
> 
> ***********************************
> Article: xxxxxxxx  
> 
>    In    Out    Balance
>   ----   ---    -------
>   10              10 
>           3          7
>           2          5
>   15              20
>           1        19
>                  ------
>     Balance:  19
> ***********************************
> 
> 
> How can I make the "Balance" work ?
> I try a computed field but I don't know how to reference a value 
> of a previous row. 
> 
> Is is possible ? 
> 
> I see that the getrow() function is available defining a computed column.

> I possible use it to get the value of a previous row ?
> 
> 
> Thanks in advance,
> 	                      Horacio.-
> 
> 
> ----------------------------------------------------
> Horacio Judeikin
> HoracioJ@bufalo.coasin.com.uy
> 
> 
0
Mark
7/23/1997 7:42:38 PM
Horacio,

Tried getrow() - 1, plus checks for the case of row 1.

Regards,

-- 
Juan Bautista Nunez R.
Softronix, Inc.
jbnunez@usa.net

In article <01bc97a4$d8d06ce0$177f03cf@TheGuest.adinet.com.uy>, 
dated Wed, 23 Jul 1997 15:10:27 -0400, Horacio Judeikin says...
> I suppose this is basic but I don't have much experience:
> 
> 
> I want to do this in a datawindow:
> (based in a table with the "article", "in" and "out" information)
> 
> ***********************************
> Article: xxxxxxxx  
> 
>    In    Out    Balance
>   ----   ---    -------
>   10              10 
>           3          7
>           2          5
>   15              20
>           1        19
>                  ------
>     Balance:  19
> ***********************************
> 
> 
> How can I make the "Balance" work ?
> I try a computed field but I don't know how to reference a value 
> of a previous row. 
> 
> Is is possible ? 
> 
> I see that the getrow() function is available defining a computed column. 
> I possible use it to get the value of a previous row ?
> 
> 
> Thanks in advance,
> 	                      Horacio.-
> 
> 
> ----------------------------------------------------
> Horacio Judeikin
> HoracioJ@bufalo.coasin.com.uy
> 
> 
0
Juan
7/23/1997 8:47:50 PM
Try using the CumulativeSum Datawindow Function.
A rough guess : CumulativeSum((in - out) for article) 

HTH
Horacio Judeikin wrote:
> 
> I suppose this is basic but I don't have much experience:
> 
> I want to do this in a datawindow:
> (based in a table with the "article", "in" and "out" information)
> 
> ***********************************
> Article: xxxxxxxx
> 
>    In    Out    Balance
>   ----   ---    -------
>   10              10
>           3          7
>           2          5
>   15              20
>           1        19
>                  ------
>     Balance:  19
> ***********************************
> 
> How can I make the "Balance" work ?
> I try a computed field but I don't know how to reference a value
> of a previous row.
> 
> Is is possible ?
> 
> I see that the getrow() function is available defining a computed column.
> I possible use it to get the value of a previous row ?
> 
> Thanks in advance,
>                               Horacio.-
> 
> ----------------------------------------------------
> Horacio Judeikin
> HoracioJ@bufalo.coasin.com.uy
0
Cesar
7/23/1997 9:33:48 PM
Hi,

Yes you can get the value of a previous row by using the columnname[ -1 ]
in your expression. -1 represents the previous row. Be sure that there is
NO space between your columnname and the '[' otherwise the expression will
not be valid.

HTH
-- 
- Met vriendelijke groet,

  Eric Aling, Cypres Informatisering bv, The Netherlands
  http://ourworld.compuserve.com/homepages/alingejj


Horacio Judeikin <HoracioJ@bufalo.coasin.com.uy> wrote in article
<01bc97a4$d8d06ce0$177f03cf@TheGuest.adinet.com.uy>...
> I suppose this is basic but I don't have much experience:
> 
> 
> I want to do this in a datawindow:
> (based in a table with the "article", "in" and "out" information)
> 
> ***********************************
> Article: xxxxxxxx  
> 
>    In    Out    Balance
>   ----   ---    -------
>   10              10 
>           3          7
>           2          5
>   15              20
>           1        19
>                  ------
>     Balance:  19
> ***********************************
> 
> 
> How can I make the "Balance" work ?
> I try a computed field but I don't know how to reference a value 
> of a previous row. 
> 
> Is is possible ? 
> 
> I see that the getrow() function is available defining a computed column.

> I possible use it to get the value of a previous row ?
> 
> 
> Thanks in advance,
> 	                      Horacio.-
> 
> 
> ----------------------------------------------------
> Horacio Judeikin
> HoracioJ@bufalo.coasin.com.uy
> 
> 
0
Eric
7/24/1997 7:03:22 PM
Reply:

Similar Artilces:

computing the difference of a column in the current row from the column of the preceding row
Hello, a user asked me if we can solve following problem: we want to compute the difference (delta) of a column in the current row from the column of the preceding row. My first solution signs where: create a computed field (small_function_result) that takes the value from the preceding row: small(value, value, cf_getrow for all); where cf_getrow is a computed field like this: if(getrow()=1,getrow(),getrow()-1) create a computed field (Diff) that computes the difference: value-small_function_result My results should look like this: Row Value cf_getrow small_func...

referencing previous row in datawindow expression
I'm trying to control the visibility of a column in my datawindow by using the following [visible] expression for column employee_id: if (employee_id = employee_id[CurrentRow() - 1],0,1) I don't want to use suppress repeating values for many reasons, mainly it's a more complicated scenario than my above example. But the above expression will only compile if I do not have a function within the brackets []. How do I say the above statement? Larry Horowitz AFAIK you are right using it without the function because a value in square brackets it interpreted rel...

Referencing previous rows compued columns
Hi guys, I'd really like to be able to do this as a calculated computed column but can't see how... Given I have 3 DW columns, TOTAL_BALANCE, ADJUSTMENTS & PAYMENTS I want a computed column COMPUTED_BALANCE which (in English) is 'If it's the first row show TOTAL_BALANCE otherwise show the previous rows COMPUTED_BALANCE minus the previous rows ADJUSTMENTS minus the previous rows PAYMENTS' I've tried variations using multiple computed columns and can't get anywhere. It's easy enough to code for in RetrieveEnd...but if there were a way I'd p...

Deleting Rows with Identity Columns through Powerbuilder Datawindow
Perhaps I should be posting this in a Powerbuilder newsgroup, but I am having the following problem: I have a Powerbuilder 6.5 application which is using an ASE 12.5 database with Enhanced Full Text Search. Because of the EFTS, many of the tables make use of identity columns. Whenever users attempt to delete a row from one of these tables through a datawindow, they receive a "Rows Changed Between Retrieve and Update Error"! I have tried changing the "ON DELETE" settings of the datawindow, but to no avail. However, I can delete records from the table th...

Q: How computed field can refer to column value in previous (or any other) row
Hi All! Subj Thank you -- Zip Zip, You would do something like: If(columnname <> columnname[-1], "Column is different", "Column is the same") HTH, Greg -- ________________________________________ Gregory R. George Greg_George@AscensionLabs.com Ascension Labs, LLC Visit www.AscensionLabs.com for PB Tips, Tricks, Tools, and Free Objects. Zip wrote in message ... >Hi All! >Subj > >Thank you >-- >Zip > > you might try something like this as the computed field's expression: colX[-1] where &quo...

Using the column value of another row in computed column.
Hi fellow PBer's, I am having trouble figuring out how to reference the column value of a specific row. In the computed columns property sheet, I select the "More" button to modify the columns expression. The way I understand help is to specify columnname[integer] where integer is the number of rows (positive or negative) relative to the current row (ie Total[-1] would be the value of the Total column in the previous row. However, I cant seem to get this to compile in the modify expression painter. I am using PB5.0 on Win95. Any help would be greatly appreciated. ...

Disabling Drop-Down datawindow columns on a row-by-row basis
Here is what I want to accomplish: I have a datawindow that contains two columns - the first is a drop-down datawindow (display column: description, data column: code) and the second is a simple edit. This datawindow will display records currently available for a specific person and will allow inserts to be made and updates to be made on existing rows - for the second column only. This means that I want the drop down datawindows to only function when doing an insert - for those rows that already exist, or those that exist after an update is issued, I want the drop-down capability t...

datawindow rows as columns
Hi I am creating a datawindow based on a table having three columns The structure i want is as follows | column2 ---------------------- column1 | column3 Is this possible ? regards husain Sure. Widen the detail band, drag the columns where you want them. "husain" <husain@sasi.com> wrote in message news:38D55B40.86BA96A8@sasi.com... Hi I am creating a datawindow based on a table having three columns The structure i want is as follows | column2 ---------------------- column1 | column3 Is th...

How to Modify Contents of a DataWindow DDLB column based on value of another column in the same row.
I'm trying to conditionally Modify the contents of a DataWindow DDLB column. For example, ls_modstr = "cp_basis.Values='5 Test~t5~tIf(cp_type=~~'TB~~',30 Day~t30,3 Year~t3)'" ls_rtn = This.Modify(ls_modstr) Does anyone have an example of syntax that works? Thanks, George I don't believe the values attribute will actually accept a function. Have you thought about using a DDDW instead and applying a filter dynamically? On Wed, 20 Feb 2002 11:10:21 -0500, in powersoft.public.powerbuilder.datawindow <George_Farrance> wrote: >...

How to go through a datatable row by row and column by column
Hello, I have a dataset with a datatable and I need to insert each row from the datatable on my sql table, anyway there may be errors, so some rows may not be inserted because primary key constraints,  So I need to show the rows that are not inserted in a gridview, the hard thing to do is to go through all the datatable,  is there an wasy way to do it?MCPD ENTERPRISE APPLICATION DEVELOPER Start by looking herehttp://msdn2.microsoft.com/en-us/library/system.data.common.dataadapter.update.aspxPerform an update of your dataset, and if a row fails, you can mark it as invalid.You can ...

Computed Column in a Datawindow
Should'nt you be able to put a ~t(tab) into a computed column? ie code + '~t' + description. I am using PB version 6.5. I know its an old version but the company I work for does not want to upgrade. No, only ~r and ~n are supported. That hasn't changed with newer versions of PB. -- Terry Dykstra (TeamSybase) Please state PB / OS / DB versions in your post. SDN: http://www.sybase.com/developer/ "Joe Dean" <bigjoed@sprintmail.com> wrote in message news:$x7R1FgeCHA.292@forums.sybase.com... > Should'nt you be able to put a ~t(tab) into...

problem with the datawindow Rows-Update Properties
i am trying to set up a datawindow for a table with a compound primary key where one of the columns is a datetime column (ASE 11.5) : xpkactivity_action_note clustered, unique activity_num, action_datetime, resource_id, activity_action_id The action_datetime column doesn't appear in the Unique Key Columns() list box in the Specify Update Properties which results in the update not working properly because the where clause is incorrect... (the column is in the Updateable Columns list). when i press the Primary Key button, it selects the other 3 columns. i can't find a...

How can I count number of rows in each datawindow in composit datawindow then access and set item in each row in each datawindow!
Hi friends, I created a composite datawindow includes three datawindow. How can I count the number of rows in each datawindow? (Rowcount() function can not works). Also, I need access in each row then reset the value that I want in each row in each datawindow. I use the property to access to get data in each row in each datawindow, but the right value only happens in the first row of each datawindow. It seems I used the loop access the value it doesn't work. Indeed, It has the all data for me but just right for the first row in each data window. Could you have any ideas, please!...

How can I count number of rows in each datawindow in composit datawindow then access and set item in each row in each datawindow!
This is a multi-part message in MIME format. ------=_NextPart_000_004F_01C308EA.58A195E0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi friends, I created a composite datawindow includes three datawindow. How can I count the number of rows in each datawindow? (Rowcount() function can = not works). Also, I need access in each row then reset the value that I want = in each row in each datawindow. I use the property to access to get data in each row in each datawindow, but the right value only happens in the = fi...

Web resources about - computed column referencing previous row - sybase.powerbuilder.datawindow

Topologically Integrated Geographic Encoding and Referencing - Wikipedia, the free encyclopedia
Topologically Integrated Geographic Encoding and Referencing , or TIGER , or TIGER/Line is a format used by the United States Census Bureau to ...

Facebook Testing Posts From Pages Users Haven’t Liked Referencing Pages Users Have Liked
Some Facebook users are seeing organic posts in their news feeds that suggest posts from pages they have not liked when the posts are in reference ...

McDonald's Ad Referencing 9/11, Boston Bombing Provokes Strong Reactions
NEW YORK — An ad by McDonald's is testing the fine line companies need to walk when referencing national tragedies. The ad by the world's biggest ...

iCloud storage warning emails already referencing iOS 8 & iCloud Drive
Those annoying iCloud storage warning email notifications have begun referencing the upcoming iOS 8 and iCloud Drive, according to multiple tips ...

Begich, Sullivan campaigns pull controversial ads referencing Mountain View case - Alaska Dispatch
... representing the victims' family in a high-profile murder and sexual assault case in Anchorage, the Sullivan and Begich camps pulled ads referencing ...

Protesters briefly disrupt Google I/O, referencing evictions, “robots that kill”
This blurred action shot is what happens when protesters unexpectedly disrupt a Google I/O keynote. The world of big tech conferences is usually ...

Emma Sulkowicz Created Rape-Referencing Video - artnet News
Watch the video that Emma Sulkowicz allegedly created, which alludes to rape, and seems to build on her controversial mattress performance.

A quick guide to referencing
Back in March as part of a series on Blog Ethics I wrote about Attribution where due , but in light of all the recent noise about spam blogs, ...

Man Arrested for Throwing Books While Referencing Scripture in Lakewood Church Store
A man was taken into custody for tossing books and knocking displays down all while referencing a particular scripture in Lakewood Church's book ...

“Tesla Crash” Website — Connecticut Auto Dealers Association Makes Anti-Tesla Website Referencing Content ...
... it simply can’t be helped. Case in point: the Connecticut Auto Dealers Association recently put together a new anti-Tesla website referencing ...

Resources last updated: 11/29/2015 3:19:19 AM