How to get value in previous column and another row from Matrix with Custom Code?

I want to calculate the value of tb_Open and tb_Close. I try to use custom code for calculate them. tb_close is correct but tb_Open is not correct that show value = 0 .
This is example report:
* I have 2 Dataset , Dataset1 is all data for show in my report. Dataset2 is only first Open for first month
* First value of Open is item field in Dataset2 and this value only for first month (january). But for other month Open value get from Close in previous month.
Detail for Red number:
1. tb_Open -> tb_Close in previous month but first month from item field in Dataset2
expression =FormatNumber(Code.GetOpening(Fields!month.Value,First(Fields!open.Value, "Dataset2")))
2. tb_TOTAL1 group on item_part = 1
expression =FormatNumber(Sum(CDbl(Fields!budget.Value)))
3. tb_TOTAL2 group on item_part = 3 or item_part = 4
expression =FormatNumber(Sum(CDbl(Fields!budget.Value)) + ReportItems!tb_TOTAL1.Value )
4. tb_TOTAL3 group on item_part = 2
expression =FormatNumber(Sum(CDbl(Fields!budget.Value)) - ReportItems!tb_TOTAL2 .Value)
5. tb_Close -> calculate from tb_TOTAL3 - tb_Open
expression =FormatNumber(Code.GetClosing(ReportItems!tb_TOTAL3.Value,ReportItems!tb_Open.Value))
My custom code:
Dim Shared prev_close As Double
Dim Shared now_close As Double
Dim Shared now_open As Double
Public Function GetClosing(TOTAL3 as Double,NowOpening as Double)
    now_close = TOTAL3 + NowOpening
    prev_close = now_close
    Return now_close
End Function
Public Function GetOpening(Month as String,NowOpen as Double)
    If Month = "1" Then
        now_open = NowOpen
    Else    
        now_open = prev_close
    End If
    Return now_open
End Function
Thanks alot for your help!
Regards
Panda A

Looks okay to me.
Perhaps the variables should be declared as public (?)

Similar Messages

  • How to get values out of spreadsheet and insert them to formula?

    So, how do i open a spreadsheet which contains two columns and several rows of data and insert those values in to a formula? To be accurate A1 shell should be input 1 (X1), shell A2 input 2 (X2), shell B1 input 3 (X3) and shell B2 input 4 (X4). After calculation it should continue to the next row and take values out of A2,A3,B2 and B3 and so on, to the end of data. I´m using Labview 7.

    Sorry, I missed the overlapping portion of the pattern.
    This one goes as follows:
    First round: A1=x1, b1=x2, a2=x3, B2=x4
    Second Round: a2=x1, B2=x2, a3=x3, b3=x4
    Oh, and I'm using Excell conventions, so A=column1, 1=Row1, B=column2, 2=Row2
    Cheers,
    J5
    2006 Ultimate LabVIEW G-eek.
    Attachments:
    Formula.vi ‏33 KB

  • How to get the current selected column and row

    Hi,
    A difficult one, how do i know which column (and row would also be nice) of a JTable is selected?
    e.g.
    I have a JButton which is called "Edit" when i select a cell in the JTable and click the button "Edit" a new window must be visible as a form where the user can edit the a part of a row.
    Then the column which was selected in the JTable must be given (so i need to know current column) and then i want the TextField (the one needed to be edited) be active with requestFocus(). So it would be
    pricetextfield.requestFocus();
    Problem now is that i have to click every time in the window the JTextField which was selected in the JTable. I have chosen for this way of editing because my application is multi-user and it would be too difficult for me when everybody did editing directly (catch signals, reload data, etc.).
    My question is how do I know the current column and the current row in a JTable?

    I'm not sure what your mean by the "current" row or column, but the following utility methods return
    which row and column have focus within the JTable.
    public static int getFocusRow(JTable table) {
        return table.getSelectionModel().getLeadSelectionIndex();
    public static int getFocusColumn(JTable table) {
        return table.getColumnModel().getSelectionModel().getLeadSelectionIndex();
    }

  • How do I select a date column and display the millesecond along with it.

    I am trying to select a date column from database and want to
    display millesecond with it. How do I do this. I am aware of
    the "alter session set NLS_DATE_FORMAT = 'MM/DD/YY HH:MI:SS'"
    command. However, I do not know how to display this with the
    millesecond.
    Thanks for all the help.

    Example:
    SQL> CREATE OR REPLACE JAVA SOURCE
      2  NAMED "MyTimestamp"
      3  AS
      4  import java.lang.String;
      5  import java.sql.Timestamp;
      6 
      7  public class MyTimestamp
      8  {
      9  public static String getTimestamp()
    10   {
    11   return (new
    12   Timestamp(System.currentTimeMillis())).toString();
    13   }
    14   };
    15  /
    Java created.
    SQL> CREATE OR REPLACE FUNCTION my_timestamp
      2    RETURN VARCHAR2
      3  AS LANGUAGE JAVA
      4  NAME 'MyTimestamp.getTimestamp() return java.lang.String';
      5  /
    Function created.
    SQL> CREATE TABLE test_time
      2    (date_col VARCHAR2 (23))
      3  /
    Table created.
    SQL> INSERT INTO test_time (date_col)
      2  SELECT my_timestamp
      3  FROM   dual
      4  /
    1 row created.
    SQL> SELECT date_col
      2  FROM   test_time
      3  /
    DATE_COL
    2001-11-02 14:58:51.766

  • Iphone 5c restore is getting stuck at the end and then it is exiting with error code (3). I just bought the iphone and i was trying to restore it for a fresh copy. Apple product

    Pleaseeeee urgent  i need help. my iphone 5c is getting stuck at the end while restoring and after 2 hours it is exiting with error code (3). Itunes downloaded the 7.0.2 ipsw and it is failing to restore the phone. i tried this on many computers and on each computer I did the uninstall and the reinstall trick for itunes. Nothing worked and im left with a ******** stuff with no software installed!!!!!!!!!!!!!!!!!!!!!

    Hi there masfahani,
    I would recommend taking a look at the troubleshooting steps found in the article below.
    iOS: Unable to update or restore
    http://support.apple.com/kb/HT1808
    -Griff W.

  • How to concatinate values of two columns and update into another column

    There is a table : TEST contains three columns - Column1 , Column2 , Column 3
    Column1 contains values - (1,2,4)
    Column2 contains values : (a,b,c)
    Column 3 is empty .
    Target : Values in column 3 should be (1a,2b,4c)
    Need to achieve this through procedure .

    Paul if i want to concatenate two strings or alpha numeric characters from 2 fields and display in the third field,Will this code be able to do that?

  • How to get plain old S-video and Composite out from a MBP?

    Hi,
    this question is about someone's MacBook Pro he newly bought with adapters to get both DVI and Svideo/Composite Out.
    He got Mini DisplayPort to DVI-D converter, and a DVI-I to video converter, that cannot be plugged into a DVI-D port. Apple removed the analog capability of its adapter, that's bad. But what's badder is there doesn't seem to have any Mini DisplayPort to Svideo/Composite adapter, as there was with previous generation machines.
    How can someone easily output analog video from MBP?

    In fact, I recognize that these standards are old, which doesn't mean they're not up-to-date. Similar example, VGA connector is old, but perfectly useful, even in 2009. I recently plugged a 22" LCD with VGA and DVI on the same computer (a bland desktop PC), and there was strictly no difference. Same color depth, same crisp display. Even looking at a corner with a magnifier, nothing was different.
    So, changing standards just for the sake of it doesn't make any sense.
    Agreed that, as a pro, Apple would like me to buy their pro line, but nowhere in the pro line does an easy solution exists for S-Video and composite out. The solution you posted exists, but is unwieldly and not neat at all, if it doesn't break the Mac's connector under its weight. If a manufacturer can do this kind of adapter, Apple can do it better, and make a bigger profit out of it.
    For the adapter you posted, I don't ever buy anything that is not at least Mac+Windows compatible, or at a minimum is open-source, so anyone with programming skills can make something. The manufacturer also doesn't give a clue on how this works. I guess some sort of virtual driver sits in the system as a virtual IEEE1394 port so any program requiring FW can work transparently. Still, incompatible with the OS that most manufacturer ship their new PCs with, poor commercial decision, wether you like the OS or not.
    Adding FW in the MB unibody design wouldn't have cost anout $30. Rather, we're talking about a 25 cents chip, a 25 cents connector, which they would have rounded up to $20 and still, that was present in previous-gen MB. After all, they are indeed selling a matte screen on the MBP 17" for $50 more, despite them removing a single piece of glass which may cost, well, let's be fair, $5 to manufacture? That's dishonest. And capitalistically justified.
    So far, choosing a Mac for one's needs is no easy task: older white MacBooks have the same power as unibodies, excellent connectivity, top notch transfer speeds, BUT are heavier, as not as ecologically friendly nor do they have future-proof RAM standard. The unibodies are sleekier, easily recycled and will be able to be upgraded in the near future BUT is most likely unable to use current devices and have slower transfer speeds.
    For Pro models, the newer ones have great efficiency, much power and flexibility with their dual GPU BUT lost the option of matte screen, although their other pro-oriented monitors still default to matte. Only the 17" has the option. If a pro already finds his 15,4" bulky and with ample reserve power, will he buy the bigger and heavier 17"? Probably not.
    I understand that Apple way of doing business is keeping only what's essential with no unnecessary options (I'm looking at you, Asus, with you at least 10 different versions of you netbook). But this time, not everyone can find what he or she wants in Apple's line of laptops, as opposed to the iPod thing, where virtually any possible preference is covered.

  • How to get value of process variable in another flex form

    Hi,
    currently we are using Flex 3 for form development in LiveCycle ES workspace.
    We have got an "Assign Task" service operation. This service operation has got a process variable defined for "input" and "output".
    The service will be called in a flex form. When the process is called a task will be sent to a user.
    When the user opens this task another flex form will be opened. All these steps work fine!
    How it's possible to get the value of the defined process variable from the first flex form (which starts the process)
    to the flex form which will be displayed when the user opens the task?
    Thanks very much for your help!
    Holger

    Solutions:
    -The 'proper' way for application specific stuff is to use a properties file, not env vars.
    -Use System.getenv(), only works for versions before 1.3
    -Use the java command line option '-D'
    -Use Runtime.exec(), similar to the way you suggested.
    -Use JNI.

  • SSRS Get value of previous row in a matrix (cannot use previous function because it's a matrix)

    I have a SSRS report which uses a matrix for a crosstab effect.
    Each row contains about 10 score values in 10 columns respectively. I need each row to check against the previous row, and i need each score value in each column to be compared to the corresponding column score value in the previous row. 
    If the current score is greater than the corresponding previous score (in the previous row), then i want to change the background of the cell.
    if the current score is smaller than the previous, then it's a different color.
    if they are equal, or it's the first row in the matrix table, then leave white.
    I have found custom code functions to use in the SSRS expression fields, but every single one of them compares against the previous COLUMN value and not the previous ROW value which is what i need. the "Previous" function would be perfect if i
    could use it in a matrix but i can't. (i keep getting error "The use of a Previous aggregate function in a tablix cell is not supported"). looking around it turns out that matrices are arrange in groups and not in rows which is why Previous can't
    be used and the only way is with custom code.
    Please help. if you have any custom code samples that achieve what i need, please share, or give me advice on how to achieve this. 
    Thank you

    I figured it out. Maybe it can help someone else in the future:
    Public Shared count as Integer = 0
    Public Shared currentRow As Integer = 1
    Public Shared MatrixStructures As New System.Collections.Generic.List(Of MatrixStructure)()
    Public Shared Function GetCellColor(row as Integer, score as Integer)
    If (row > currentRow) Then
    count = 0
    currentRow = row
    End If
    count = count + 1
    Dim matrixStructure As New MatrixStructure()
    matrixStructure.RowIndex = row
    matrixStructure.ColumnIndex = count
    matrixStructure.ScoreValue = score
    MatrixStructures.Add(matrixStructure)
    If score = 0 Then
    Return "White"
    End If
    Dim val As MatrixStructure = MatrixStructures.Find(Function(s As MatrixStructure)
    Return s.GetRowIndex() = row - 1 AndAlso s.GetColumnIndex() = count
    End Function)
    If (Not (val Is Nothing)) Then
    If val.scoreValue = 0 Then
    Return "White"
    End If
    If score >= val.scoreValue + 2 Then
    Return "Green"
    ElseIf score <= val.scoreValue - 2 Then
    Return "Red"
    End If
    End If
    Return "White"
    End Function
    Public Class MatrixStructure
    Public rowIndex As Integer
    Property GetRowIndex() As Integer
    Get
    Return rowIndex
    End Get
    Set(ByVal Value As Integer)
    rowIndex = Value
    End Set
    End Property
    Public columnIndex As Integer
    Property GetColumnIndex() As Integer
    Get
    Return columnIndex
    End Get
    Set(ByVal Value As Integer)
    columnIndex = Value
    End Set
    End Property
    Public scoreValue As Integer
    Property GetScoreValue () As Integer
    Get
    Return scoreValue
    End Get
    Set(ByVal Value As Integer)
    scoreValue = Value
    End Set
    End Property
    End Class
    and to pass the current row number from the expression i use this
    Ceiling(RowNumber(NOTHING) / 10)
    i divide the row number by 10 because there are ten columns. if you don't know the number of columns, or it's a variable number, then return it from the stored procedure query in the first place. that's what I had to do

  • TS3212 how do I download my previous songs and new songs to my ipod

    How do I download my previous songs and new song from Itunes to my ipod

    lbcasey wrote:
    How do I download my music from the Itunes website to my Ipod? 
    LB casey, By "website," are you thinking of the iCloud, which enables the re-downloading of your previous purchases from the iTunes Store?  Please see the following documents:
    iTunes 11 for Windows: Download previous purchases from the iTunes Store
    http://support.apple.com/kb/PH12491
    iTunes 11 for Mac: Download previous purchases from the iTunes Store
    http://support.apple.com/kb/PH12283

  • How to get warning by using the previous value of the column and new value

    Hi all,
    Suppose the column A has the true and when I click on button which also sets the value of the column as true I should dispaly warning that column a is already true.How can I achieve this.How to store the original value of the column and then check wirth the new value.
    Thanks in advance.

    You dont have to store the value anywhere
    You can do this from setMethod of EOImpl.java
    eg:
    void setAttributeXXX(String Value)
    // value contains new value
    // getAttributeXXX() contains oldValue
    if (value.equals(getAttributeXXX()))
    // Verify value is > 0 if (value.compareTo(0) <= 0)
    throw new OAAttrValException(OAException.TYP_ENTITY_OBJECT, // indicates EO source
    getEntityDef().getFullName(), // entity name
    getPrimaryKey(), // entity primary key
    "AttributeXXX", // attribute Name
    value, // bad attribute value
    "AK", // nessage application short name
    "FWK_TBX_T_EMP_SALARY_REQUIRED"); // message name
    setAttributeInternal(AttributeXXX, value);
    --Prasanna                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to get the values of all elements and sub elements from  following xml

    how to get the values of all elements and sub elements from following xml...
    <?xml version="1.0" encoding="UTF-8" ?>
    <List_AML_Finacle xmlns="http://3i-infotech.com/Cust_AML_Finacle.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://3i-infotech.com/Cust_AML_Finacle.xsd List_AML_Finacle.xsd">
    <TransactionID>TransactionID</TransactionID>
    <Match>
    <Src_Matched_Field>Src_Matched_Field</Src_Matched_Field>
    <List_Matched_Field>
    <FSFM_Matches>
    <NUMBER>NUMBER</NUMBER>
    <TERROR>TERROR</TERROR>
    <TU>TU</TU>
    <NAMEU>NAMEU</NAMEU>
    <DESCRIPT>DESCRIPT</DESCRIPT>
    <KODCR>KODCR</KODCR>
    <KODCN>KODCN</KODCN>
    <AMR>AMR</AMR>
    <ADDRESS>ADDRESS</ADDRESS>
    <SD>SD</SD>
    <RG>RG</RG>
    <ND>ND</ND>
    <VD>VD</VD>
    <GR>GR</GR>
    <YR>YR</YR>
    <MR>MR</MR>
    <CB_DATE>CB_DATE</CB_DATE>
    <CE_DATE>CE_DATE</CE_DATE>
    <DIRECTOR>DIRECTOR</DIRECTOR>
    <FOUNDER>FOUNDER</FOUNDER>
    <TERRTYPE>TERRTYPE</TERRTYPE>
    </FSFM_Matches>
    <OfacMatchDetails>
    <UID>UID</UID>
    <TITLE>TITLE</TITLE>
    <SDNTYPE>SDNTYPE</SDNTYPE>
    <REMARKS>REMARKS</REMARKS>
    <ID_UID>ID_UID</ID_UID>
    <IDTYPE>IDTYPE</IDTYPE>
    <IDNUMBER>IDNUMBER</IDNUMBER>
    <IDCOUNTRY>IDCOUNTRY</IDCOUNTRY>
    <ISSUEDATE>ISSUEDATE</ISSUEDATE>
    <EXPIRATIONDATE>EXPIRATIONDATE</EXPIRATIONDATE>
    <ADDRESS1>ADDRESS1</ADDRESS1>
    <ADDRESS2>ADDRESS2</ADDRESS2>
    <ADDRESS3>ADDRESS3</ADDRESS3>
    <CITY>CITY</CITY>
    <STATEORPROVINCE>STATEORPROVINCE</STATEORPROVINCE>
    <POSTALCODE>POSTALCODE</POSTALCODE>
    <COUNTRY>COUNTRY</COUNTRY>
    </OfacMatchDetails>
    </List_Matched_Field>
    </Match>
    </List_AML_Finacle>

    avoid multi post
    http://forum.java.sun.com/thread.jspa?threadID=5249519

  • How to get line item net price and net value?

    I have using "BAPI_SALESORDER_SIMULATE" to SIMULATE to create SO,
    the return table
    ORDER_ITEMS_OUT-NET_VALUE is not equals than created by VA01 .
    how to get line item net price and net value?

    Hi,
    Can u elaborate ur query ?
    By this FM you cannot create a SO . Use FM --> BAPI_SALESORDER_CREATEFROMDAT2
    Regards,
    MAdhukar Shetty

  • How to get string (specified by line and column) from txt file with labview

    Hi everyone
    How to get string (specified by line and column) from txt file with labview
    thx 
    Solved!
    Go to Solution.

    As far as I know, a text file has no columns.  Please be more specific.  Do you mean something like the 5th word on line 4, where words are separated by a space, and lines are separated by a newline character?  You could the Read from Spreadsheet String function and set the delimiter to a space.  This will produce a 2D array of strings.  Then use index array and give the line number and column number.
    - tbob
    Inventor of the WORM Global

  • How to get value in a web page automatically  and sava output in database

    how to get value this table output is
    row 1, cell 1
    row 1, cell 2
    row 2, cell 1
    row 2, cell 2
    <table border="1">
    <tr>
    <td>row 1, cell 1</td>
    <td>row 1, cell 2</td>
    </tr>
    <tr>
    <td>row 2, cell 1</td>
    <td>row 2, cell 2</td>
    </tr>
    </table>

    Note: This thread was originally posted in the [Java Technologies for Web Services|http://forums.sun.com/forum.jspa?forumID=331] forum, but moved to this forum for closer topic alignment.

Maybe you are looking for

  • How to get the WorkInstruction from a hook context

    Hi, i have a PRE_BATCH_START hook and i would like to get the work instruction for the operation that this hook is on. Is there an API to somehow read the content of the work instruction? Using ME 6.0.2.2.12 Thanks in advance, David

  • Windows/updater wont acknowledge my iPod, but will acknowledge another iPod

    Hi, I just got an iPod Nano for my birthday from a friend, it had no installation disk, but was unused. I tried to install the iPod into my PC by connecting it through the USB port in the front. My windows says "One of the USB devices attached to thi

  • 3 Must have features for front-end developers

    I'm a front-end developer, so these requests are more or less specific to my job. Selecting an entire layer Currently: If you do a "ctrl-click" on a layer, it selects the layer. However, if you have filters or effects applied to the layer, it does no

  • Problems Undeploying on Application Server

    I am having problems with the "asant undeploy" command because after I try to re-deploy a .war file, I get the error message below in the servers log. I'm guessing the original undeploy was not completed successfully despite what it says at the comma

  • How I stopped the dreaded "Mooing" sound on my MacBook. (possible solution)

    So I am probably not the last one on this forum to find the dreaded mooing sound on their brand new laptop! Yes, I do love my Macbook and it's quite and upgrade from the 15" PowerBook that I came from,(better screen, faster),.. but the day I received