Totals Based on Multiple Criteria in Repeating Rows

Hi All,
I have 3 dropdowns (DD1, DD2, DD3) and one textfield (TF1) in repeating rows (not in a table).  Each dropdown has two choices and the textfield is free-form. Outside of the rows (in a different subform) I want totals based on multiple criteria from the dropdowns and textfields.
The following script works great to get a total number of one choice from one dropdown.
this.rawValue = xfa.resolveNodes('form1.Form.row[*].DD1.[$.rawValue == "2"]').length;
Problem is how do I calculate the totals for the following based on the criteria listed in each row.
Find the totals for ML
Number of New Forms 1-2 Pages: (result should be 2)
Number of New Forms 3+ Pages: (result should be 1)
Number of Revised Form: (result should be 0)
In row #1:  select “New” as a choice from DD1, “Form” as choice from DD2, “ML” as a choice from DD3 and enter “5” in TF1.
In row #2:  select “New” as a choice from DD1, “Form” as choice from DD2 , “ML” as a choice from DD3 and enter “1” in TF1.
In row #3:  select “New” as a choice from DD1, “Form” as choice from DD2, “ML” as a choice from DD3 and enter “2” in TF1.
In row #4:  select “Revised” as a choice from DD1, “Series” as choice from DD2, “ML” as a choice from DD3 and enter “1” in TF1.
In row #5:  select “New” as a choice from DD1, “Form” as choice from DD2, “PM” as a choice from DD3 and enter “1” in TF1.

Try something like;
var mlNewForms1or2Pages = 0;
var mlNewFormsOver3Pages = 0;
var mlRevisedForms = 0;
var rows = xfa.resolveNodes('form1.Form.row[*]');
for (var i = 0, limit = rows.length; i < limit; i++)
var currentRow = rows.item(i);
if (currentRow.DD1.rawValue == "1") // new
  if (currentRow.DD2.rawValue == "1") // form
   if (currentRow.DD3.rawValue == "1") // ML
    if (parseInt(currentRow.TF1.rawValue, 10) > 2)
     mlNewFormsOver3Pages++;
    else
     mlNewForms1or2Pages++;
else // revised
  if (currentRow.DD2.rawValue == "1") // form
   if (currentRow.DD3.rawValue == "1") // ML
    mlRevisedForms++
console.println(mlNewForms1or2Pages);
console.println(mlNewFormsOver3Pages);
console.println(mlRevisedForms);
To do the same using predicates you could do;
var mlNewForms1or2Pages = 0;
var mlNewFormsOver3Pages = 0;
var mlRevisedForms = 0;
mlNewForms1or2Pages = xfa.resolveNodes('form1.Form.row.[DD1 == 1 and DD2 == 1 and DD3 == 1 and TF1 <= 2]').length;
mlNewFormsOver3Pages = xfa.resolveNodes('form1.Form.row.[DD1 == 1 and DD2 == 1 and DD3 == 1 and TF1 > 2]').length;
mlRevisedForms = xfa.resolveNodes('form1.Form.row.[DD1 == 2 and DD2 == 1 and DD3 == 1]').length;
But if you wanted totals for all the permutations then this could become slow.
Regards
Bruce

Similar Messages

  • Help me write command in vba(excel) to search and find special cells based on multiple criteria

    Hi 
    My name is Majid Javnmard , I am using Microsoft Office Excel 2010 and I encountered a problem. I sent you a simple example of my excel file that i want to write a command in vba to search and find special cell and copy the row which special cell is in there
    somewhere , but the problem is how can i find my special cell with multiple criteria or how can i find my all special cells and copy them somewhere !!? 
    Let me explain on file that i sent :
    This file has 4 headers (X,Y,PerturbNumber,Value), the problem is for example : I want write commnd in vba to copy all rows that each of them has (X=12 and Y=13). how can i ? can you help me ?
    My
    file : http://s000.tinyupload.com/index.php?file_id=69742844961096241754
    Many Thanks
    Majid 

    This worked for me, based on your example:
    Sub pMain()
    Dim wsSource As Excel.Worksheet
    Dim wsDest As Excel.Worksheet
    Dim lSource As Long
    Dim lDest As Long
    Dim lLast As Long
    With ThisWorkbook
    'Change to suit
    Set wsSource = .Worksheets("Sheet1")
    Set wsDest = .Worksheets.Add
    End With
    wsSource.Rows(1).Copy
    wsDest.Range("A1").PasteSpecial xlPasteValues
    lDest = 2
    lLast = wsSource.Cells(wsSource.Rows.Count, "A").End(xlUp).Row
    For lSource = 1 To lLast
    'Put the conditions below:
    If wsSource.Cells(lSource, "A") <> 12 Then GoTo linNext
    If wsSource.Cells(lSource, "B") <> 30 Then GoTo linNext
    'If wsSource.Cells(lSource, "C") <> "value" Then GoTo linNext
    'If wsSource.Cells(lSource, "D") <> "value" Then GoTo linNext
    'Conditions were met:
    wsSource.Rows(lSource).Copy
    wsDest.Rows(lDest).PasteSpecial xlPasteValues
    lDest = lDest + 1
    linNext:
    Next lSource
    End Sub
    Felipe Costa Gualberto - http://www.ambienteoffice.com.br

  • Return a value based on multiple criteria

    Dear Support Community,
    I am trying to formulate a function so that I am able to return a cell value based on more than one criteria.
    Referring to the attached screen shot, "Local Start Time" refers to the time that a person will start a work shift, and depending on the "sectors" the person's duration of time at work will vary.
    For example, if a person starts work between 07:00am and 07:59am AND the particular shift involves 2 sectors, the allowed time at work is 12H15M. However, given the exact start time, if the shift only involves ONE "sector' the allowed time at work becomes 13H00M etc.
    I am trying to formulate a function whereby I can tell the spreadsheet the local start time AND sectors, and then have the appropriate time returned.
    I hope the above makes sense!
    Thanks
    ST

    Hi ST,
    Print your table and pin it up as a "Ready Reckoner" for humans to refer to.
    Convert your table into a Database, something like this:
    Start
    Finish
    Sectors
    Allowed Duration
    Scenario
    0700
    0759
    1
    13h 0m
    1
    0700
    0759
    2
    12h 15m
    2
    0700
    0759
    3
    11h 30m
    3
    0800
    1259
    1
    14h 0m
    4
    0800
    1259
    2
    13h 15m
    5
    0800
    1259
    3
    12h 30m
    6
    1300
    1759
    1
    13h 0m
    7
    1300
    1759
    2
    12h 15m
    8
    1300
    1759
    3
    11h 30m
    9
    1800
    2159
    1
    12h 0m
    10
    1800
    2159
    2
    11h 15m
    11
    1800
    2159
    3
    10h 30m
    12
    2200
    0659
    1
    11h 0m
    13
    2200
    0659
    2
    10h 15m
    14
    2200
    0659
    3
    9h 30m
    15
    (You may want to check that I have converted correctly)
    Columns A and B have a Custom Format that allows them to be numbers (not Text) with leading zeroes.
    Hide Separator to get rid of the comma
    Show zeroes for Unused Digits to show leading zeroes.
    Then you can enter "Army Time" (24 hour clock with leading zeroes) into a Query table
    Thunderstorms playing havoc here with my internet connection. I will post this now. Watch for the next instalment.
    Regards,
    Ian

  • Counting rows with multiple criteria

    I know this is a silly beginner question, but is there an easy way to count the number of rows in a table which match criteria based on different columns (sort of a countif with multiple criteria). For example, if Column A in a table has "All, Some, None" responses and Column B has "Main, Off" responses, is there an easy way to count the number of rows in which Column A has All and Column B has Off?

    Neondiet wrote:
    From an intellectual and philosophical view I agree with you. But from a practical view what I really want to do is just use one application for my spreadsheet tasks, not jump back and forth because one sheet I share with MS Windows users, and another with Numbers users, and another with OS X users who don't have Numbers or Excel but do have NeoOffice. Maybe I have to settle for that though.
    Yeah... this kind of situation stinks. Its like needing to writing software that will run on both Macs and PCs.
    Anyway, I've followed the advise in this forum and resorted to using a hidden column with concatenated values to solve my own problem, though it does seem like a bit of a hack compared to managing a single formula in a single cell. Horses for courses I suppose.
    jaxjason has posted a very elegant pivot table like solution that utilizes this technique. See http://www.numberstemplates.com/forums/showthread.php?t=36
    Btw, from what I've read on the net to date, SUM (in Excel) with an array formula answers the original authors problem of counting occurrences of values, not SUMPRODUCT; which I believe sums up the contents of cells in a range, if cells in other ranges match specific criteria.
    Yes, if you use the '*' (as indicated above) then SUM() is sufficient though SUMPRODUCT() will work as it degenerates to SUM when there is only one argument. If you use two arrays as arguments (like: = SUMPRODUCT((A1:A4="All"), (B1:B4="Off")), then SUMPRODUCT() is necessary. Here's my understanding of how it works (I hope your able to follow my abuse of algebraic techniques):
    =SUM((A1:A4="All") * (B1:B4="Off"))
    expanding the array expressions...
    =SUM((A1="All", A2="All", A3="All", A4="All") * (B1="Off", B2="Off", B3="Off", B4="Off"))
    at this point Excel computes the equality expressions, for example...
    =SUM((TRUE, FALSE, TRUE, FALSE) * (TRUE, TRUE, FALSE, FALSE))
    expanding the array multiplication...
    =SUM((TRUE * TRUE, FALSE * TRUE, TRUE * FALSE, FALSE * FALSE))
    Excel, apparently, then, when forced to multiply Boolean values, maps TRUE -> 1 and FALSE -> 0...
    =SUM((1 * 1, 0 * 1, 1 * 0, 0 * 0))
    performing the multiplications...
    =SUM((1, 0, 0, 0))
    summing...
    =1 + 0 + 0 + 0
    resulting...
    =1
    I'm afraid, now, if I continue any further, Yvan will chastise me.

  • Repeate Row Totals on every horizontal pages in Crosstab.

    Hi
    I have a crosstab which grows multiple page horizontally.
    I have Row totals that are displayed on the left of summary. I want to display this totals on every horizontal page.
    Can anyone tell mw how to achieve this.
    I am using Crystal Reports XI with SP as data source.

    Hi Narayan
    Right Click on the Cross Tab->Cross-Tab Expert-> Customize Style tab.
    Select the 'Horizontal' option under summarized Fields:
    Select the 'Repeat Row Labels' option under 'Grid Options'
    Click 'OK'
    However it is not possible to dispaly the row totals for the data dispalyed on that particular page.
    Because the data is calulated for the entire cross-tab.
    Hope this helps you.
    Please let us know if you need any further information.
    Regards
    Ashwini Yadav

  • Total based on selected rows

    Hi,
    I have a column called record type and I would like to sub-total based on
    selected rows from the record type at the bottom. how do I do it ?
    for ex:
    rtype load
    s - 100
    b - 150
    r - 200
    z - 10
    total load1 b+r - 350
    total load2 b+z - 160
    ------------------------------------------

    You can use calculations in pivot tables to operate with distinct values of a column. You can create a new column (or row) as 'b' + 'r' record types. You can select wether to see original and total columns or only totals.
    See 'Examples of Calculations in Oracle BI Pivot Tables' section in "Oracle® Business Intelligence Answers, Delivers, and Interactive Dashboards User Guide" document.

  • Highligting rows based on multiple conditions

    Hi,
    I have to show a report with exceptions highlighted in RED color. Exceptions are based on some conditions:
    If I have four columns in an answer request, two of which say "Level" and "Status".
    based on the "Level" and "Status" column conditions I have to highlight entire row which satisfies any of the condition.
    Ex: If I have Level=3,4,5 and Status= Y,N then for
    Level=3 or Status=N is one exception.
    Level=4,5 or Status=Y is another exception.
    Based on this two column conditions I have to highlight entire row in the report.
    Can we do this in OBIEE. Highlighting rows based on multiple conditions?
    Thanks in advance!

    Thanks for the reply.
    I have tried that already. I can highlight one specific field but not entire row.
    If I keep on applying the conditional format for the other columns too then I can't apply the conditions.
    Anyways, I have created a dummy column with the conditions in it and then applied that to the other fields and used conditional format to highlight the color.

  • How to repeat rows based on column value

    Hi all,
    I have a query that gives me a result with a column value for example 4.
    I now want to repeat this row 4 times with a new column that calculated from 1 - 4.
    Or when column value is 3 I want to repeat row 3 times with new column name 1-3
    Can anyone help me with this please? :)

    Hi Yvanlathem,
    To achieve your requirement, you can reference the recursive approach as below.
    DECLARE @T TABLE(Col1 CHAR(1),Col2 INT)
    INSERT INTO @T VALUES('A',1),('B',2),('C',3)
    ;WITH Cte([Char],[Repeat]) AS
    SELECT Col1,Col2 FROM @T
    UNION ALL
    SELECT [Char],[Repeat]-1 FROM Cte
    WHERE [Repeat]>1
    SELECT * FROM Cte ORDER BY [Char],[Repeat]
    OPTION(MAXRECURSION 0)
    /* Output
    Char Repeat
    A 1
    B 1
    B 2
    C 1
    C 2
    C 3
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • Repeatable row disabled by default. Need to enable all rows based on value in XML.

    I have a repeatable row in a table that is defaulted to read only.   If a certain value doesn't exist in the XML (populated != x), I want to make add / remove buttons visible and and make the text fields in the row and all subsequent instances Open.
    when populated !=x:
    This is the code:
    if (xfa.host.name != "XFAPresentationAgent" && this.resolveNode("populated").rawValue != "x") {
      oTargetField = this.resolveNode("#subform[2].tbl_people.person.name");
          oTargetField.access = "open";
      oTargetField = this.resolveNode("#subform[2].tbl_people.person.relationship");
          oTargetField.access = "open";
      oTargetField = this.resolveNode("#subform[2].tbl_people.person.age");
          oTargetField.access = "open";
    When I use this, it only enables the first row and none of the subsequent rows/instances.  
    Any assistance would be greatly appreciated!
    -Jeff

    Hi DCS_JeffW,
    I guess, you need to follow these steps:
    1) You need to find the number of repeating rows first. Assuming that "people.person" is the repeating instance:
                    var countOfPPInstances = xfa.resolveNode("....people.person").instanceManager.count;
    2) Modify your code as follws:
                    if (xfa.host.name != "XFAPresentationAgent" && this.resolveNode("populated").rawValue != "x")
                                    for(var i=0;i<countOfPPInstances;i++)
                                     xfa.resolveNode(“..people.person[“+i+”].name").access=”open”;
                                                      xfa.resolveNode(“..people.person[“+i+”].relationship").access=”open”;     
                                                      xfa.resolveNode(“..people.person[“+i+”].age").access=”open”;
    Let me know if this works. Alternatively, you can mail me your form @ [email protected]

  • If / then calculation based on dropdown list value in repeating row

    Hello
    I am new to Livecycle. I have created a repeating row in a form. The last field in the repeating row is a numeric field that = the product of two previous fields in the row (NumericField1 *  Numeric Field2). I also have a DropDownList1 near the beginning of the row (third column) that contains variable categories for that calculation row, e.g. Advertising, Office Supplies, Entertainment. I would like to create numeric fields in the form (perhaps in a footer row?) that contain sums of the subtotals of each row, depending on the category selected in DropDownList1. In other words I need to create a subtotal field for all calculations beginning with the category of Advertising, another for Office Supplies, another for Entertainment.
    From what I understand I need to list the variables first, then create an if/then calculation but I am not sure about the steps involved in creating the script.
    df

    NumericField3 is the name of the field containing the product of NumericField1 * NumericField2. I have created a NumericField8 in the form with the following calculation in FormCalc:
    if(Table1.Row.DropDownList1.rawValue == "ADVERTISING") then
    sum(Table1.Row[*].NumericField3)
    end if
    That's not helping. I think I need to designate variables before the if/then script, yes? Would I need to use a resolve command, a getfield command, or . . .? Can anyone help?
    Thanks, in advance,
    df

  • Color report rows based on a value in that row

    I would like to Color report rows based on a value in that row.
    For examplle with the "EMP" table:
    I would like job=MANAGER to be red and job=CLERK to be green etc etc
    The other example I found only had the option of one color either the highlight or the default color.
    I am looking for a way to do multiple colors.

    Hi,
    In the row template, you can use #1#, #2#, etc to indicate where a field in the report needs to be output. This does not have to be plain text - ie, you can use it within style tags if you like.
    So, take a query like:
    SELECT EMPNO,
    ENAME,
    DEPTNO,
    DECODE(DEPTNO, 10, 'green', 20, 'red', 30, 'cyan', 'white') BG_COLOUR
    FROM EMPYou get columns 1=empno, 2=ename, 3=deptno and 4=bg_colour. In the row template, you can then do:
    Before Rows setting (sets up the table):
    &lt;table&gt;
    &lt;tr&gt;&lt;td&gt;ID&lt;/td&gt;&lt;td&gt;Name&lt;/td&gt;&lt;td&gt;Dept&lt;/td&gt;&lt;/tr&gt;After Rows setting (closes the table):
    &lt;/table&gt;Row Template 1 (used for ALL rows):
    &lt;tr style="background-color:#4#;"&gt;&lt;td&gt;#1#&lt;/td&gt;&lt;td&gt;#2#&lt;/td&gt;&lt;td&gt;#3#&lt;/td&gt;&lt;/tr&gt;Then, for every row, the colour that has been calculated using the DECODE function will be used in the style tag to colour the background for the entire row.
    How you determine the colours is up to you. I've used DECODE here, but you could use a field on the DEPT table to hold this and use this in your SQL statement.
    Andy

  • Hierarchy: How to suppress duplicated/repeated rows in a BEx query

    Hi Gurus.
    I have a BEx query which displays data based on a Cost Element hierarchy.  When the hierarchy is expanded to leaf level (or any level), all key figures and characteristics are displayed for the leaf level but are also repeated throughout all the levels above.
    Is it possible to suppress the repeated rows in higher levels of the hierarchy and display a summary result only?
    The issue we have is that if the user wishes to export or save a workbook, they will have to filter and manipulate the report a great deal which is impractical.
    I'm hoping it's a simple setting that I've missed.  I look forward to receiving the magic answer!! :o)
    Thanks,
    Angela

    Hi All,
    I've been playing around a bit more and found a setting which I hope my users will find acceptable:
    From the query - Query properties -> Data Formatting tab - Multidimensional View -> select Display Rows hierarchically and expand to (chosen characteristic)
    Can anyone tell me if I can set this as a default setting in the query designer, or will I need to create a view to save the setting?
    Thanks all,
    Angela

  • How to create repeating rows field type in visual studio for sharepoint

    HI
         I would like to check if there is any work around for the repeating rows field
    type other than buying 3rd party tool or using info path, Because i have SharePoint foundation server.
    Thanks

    Hello,
    You can use repeater control in custom webpart where you can add multiple details similar to repeating table:
    http://www.c-sharpcorner.com/Blogs/10913/add-dynamic-row-using-repeater.aspx
    Correct me if i misunderstood you
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • Person DFF Context Value based on 2 criteria (Business Group and Emp Type)?

    Hello,
    We're implementing HR module into multiple business groups.
    I need to define context value for DFF "Additional Personal Details" based on 2 criteria Business Group ID and Employee Type
    Any idea how to do it?
    Thank you
    Elie

    Hello Elie,
    I am not sure on it,However have you tried creating a context with combination of Business Group and Person Type using merging,
    business_group_id || "_"|| person_type_id And structures would be something like 80_2112 Business Group id = 80 and Person Type id=2112.
    It may resolve your issue if this works out.
    Regards,
    Saurabh

  • Display LOV based on view criteria

    Hi,
    I have a SelectOneChoice list in the table column. I want to display its items dynamically based on view criteria. So that when i select a row in the table, the list should have only filtered items.
    I am using Jdeveloper version 11.1.1.6.0. Below is the code for SelectOneChoice list.
    <af:selectOneChoice value="#{row.bindings.IntegrationName.inputValue}"
    label="#{row.bindings.IntegrationName.label}"
    required="#{bindings.ManageProjectIntegration1.hints.IntegrationName.mandatory}"
    shortDesc="#{bindings.ManageProjectIntegration1.hints.IntegrationName.tooltip}"
    id="soc5"
    readOnly="#{row.EnabledFlag eq 'ACTIVE' or backingBeanScope.managed_ManageProjectIntegrationBean.singleIntegration}"
    valueChangeListener="#{backingBeanScope.managed_ManageProjectIntegrationBean.validateIntegrationName}"
    binding="#{backingBeanScope.managed_ManageProjectIntegrationBean.integrationChoiceList}"
    autoSubmit="true" valuePassThru="false"
    immediate="false"
    contentStyle="width:180.0px;">
    <f:selectItems value="#{row.bindings.IntegrationName.items}"
    id="si7"/>
    Thanks
    Harish

    Harish,
    Have you tried creating a model driven list by using the view criteria?
    http://www.baigzeeshan.com/2010/03/how-to-create-adf-lov-with-view.html
    -Arun

Maybe you are looking for

  • Goods Receipt with respect to sales order

    hi,     goods receipt with respect to sales order ,that sales order is prepared with reference to quotation erroer is Account assignment cannot be carried out because of different origin no. Message no. V1134 Diagnosis The sales document to which you

  • Print jobs come out as blank pages with Windows 7, Bonjour & Canon iP4700

    Hi there, I have a Macbook Pro with OSX 10.6.1 and have a Canon iP4700 inkjet printer connected to this via USB and this works fine. I've shared the printer from the Mac so that I can print to it from a Dell laptop on the same home network which is r

  • CSS Image loading problem by dynamically loading from fxml file?

    h1. Introduction The application I am developing loads an FXML file from a Controller. The FXML uses CSS and images for buttons are set in the CSS. CSS directory structure <package>.fxml Images <package>.fxml.resources.<subdir> Example CSS Code .butt

  • Help, Pivot SQL

    I am doing a report for a book store. We have data like: STORE_ID SUBJECT     SUB_DETAIL     NUMBERS 1001     CD     CD_TITLE1     2 1001     CD     CD_TITLE2     4 1001     CD     CD_TITLE3     1 1001     DVD     DVD_TITLE1     7 1001     DVD     DV

  • ITunes Installer Issues

    Whenever I try to install the new verison of iTunes (10.5.3) I get the same error message. ("There is a problem with this Windows installer package. A program required for this installer to complete could not be run") I am running a 32-bit Windows Vi