Sum 2d arrays with different columns width

hi,
I have a 2d array that stores the number of rats in X number of houses.
in each row, i have the number of rats per house (length) and the weight of each.
So, if I have 3 houses, I would 3 rows (0,1,2).
And, in house 1: I have 2 rats (0,1)
then, rat1 weights 20, rat2: 15
in house 2: I have 3 rats (0,1,2)
rat1: 30, rat2: 25 rat3: 5
in house 3: I have 1 rat (0)
rat1: 50
So, what I need to do is to calculate the total weight of rats per house and display:
Total weight in House1: 35
House2: 60
House3: 50
I dont know how to do the sum and display the sum for each house. Any hints/solutions?
Message was edited by:
gixty
Message was edited by:
gixty

> yeah, but I am still looking for a way to sum every
column per row.
You've been given the same solution on two different forums. If you know how to loop through the houses, you know how to loop through the rats. The "rat loop" will be nested inside the "house loop". Each rat will be identified by two indices; the house index and the rat index. Just loop through the rats, adding each rat's weight to the total for that house.
~

Similar Messages

  • Array to different columns

    Hello,
    In the attached VI, I am currently getting all the arrays to show up in the same columns. I am trying to show each pass in the attached VI to show as different colums in the string table.
    Any help will be appreciated. 
    Thanks,
    hiNi.
    Solved!
    Go to Solution.
    Attachments:
    array to different columns.vi ‏21 KB

    I would allocate a string array at the final size, then replace data as you go. Here's  quick rewrite (LabVIEW 8.5).
    (I don't understand your use of the local variable, sequence structure, and while loops. The first two are not needed and the loops should be FOR loops because you know the number of iterations beforehand.
    (Also note that you should work with strings for the final table. A numeric array will be padded with zeros for undersized rows or columns. An empty string for missing elements seems more appropriate.)
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    array to different columnsMOD.vi ‏16 KB

  • BO xi 3.1 u2013 schedule a template for multiple reports with different column

    Hi,
    I need to migrate the existing reports from SQL Server Reporting Services to BO, and the column order in the report is very important to the clients since clients have existing code to ingest these reports into their database. Now I want to schedule a single template with different parameters for all reports in BO, or create a single template with lot of parameters for all reports. My question is how I might use one template to create multiple reports with different column orders in the reports?
    For example, client A has the following column order in their report: firstName, LastName, DateBirth, SSN. Client B has the following column order in their report: SSN, DateBirth, LastName, FirstName. Can I use one template to create these multiple reports?
    Thanks!

    Hi,
    The only approach I can think of is to create a template report which uses variables
    For each column you would need to variable
    v_columnAName and v_columnAValue
    v_columnAName would have a if statement in it
    =if([client]="clientA" or [client]="clientC";NameOf([firstName]);if([client]="clientB";NameOf([SSN]);NameOf([lastName]));
    v_columnA would have a if statement in it
    =if([client]="clientA" or [client]="clientC";[firstName];if([client]="clientB";[SSN],[lastName]));
    This would only work when you had a small set of clients.
    This might be more managable if it was done in the universe
    Regards
    Alan

  • Is it possible to create a Synonym with different column names

    Hi,
    I want to create a Synonym with different columns names (Columns not in original table) . I am not sure if this can be done . Any suggessions...
    Thanks in advance....

    Synonyms are not limited to tables. Accroding to the SQL Reference, a synonym is:
    an alternative name for a table, view, sequence, procedure, stored function, package, materialized view, Java class schema object, user-defined object type, or another synonym.
    In fact, synonyms are not even validated until they are used:
    SQL> create synonym my_synonym for table_which_does_not_exist;
    Synonym created
    SQL> select * from my_synonym;
    select * from my_synonym
    ORA-00980: synonym translation is no longer valid

  • How to generate and output 3 TTL square waveforms with different pulse widths using counters of NI 6034E

    Hello
    I just have a few questions.
     I am using the NI 6034E DAQ board in order to
    generate simultaneouly 3 different TTL digital signals, with different
    pulse width, and output these TTL signals to an external circuit that I
    am using for this application.
    The following pattern of the TTL pulses will look like this:
    01010101 01010101
    00110011 00110011
    00001111 00001111
    From
    what I understand,  I have to use the 2 counters, Ctr0 and Ctr1, to
    generate the TTL pulses that I desire, because the DIO lines are
    software timed only and I will not be able to produce a deterministic
    output period using these DIO lines.  Am I correct?    Also, do I have
    to use a separate counter to generate a separate TTL digital pulse.  I
    need 3 different TTL pulses and there are only 2 counters for this DAQ
    device.  The three generated TTL signals will be feed to an external
    circuit.  Concerning the hardware connections for my application, I
    assume that the generated TTL signals will be output from
    GPCTR0_OUT(pin 2)  for counter 0 and GPCTR1_OUT(pin 40) for counter 1
    of the NI 6034E. Is this correct?  Is there any way that these TTL
    signals can be output from three DIO lines(DIO0...2). 
    Here is some code that I plan to use in order to do this:
     #include <NIDAQmx.h>
    static TaskHandle gTaskHandle = 0;
    DAQmxCreateTask ("", &gTaskHandle);
    DAQmxCreateCOPulseChanTime (gTaskHandle, "Dev1/ctr0", "", DAQmx_Val_Seconds, DAQmx_Val_Low, 1.0, 2.0, 2.0);
    DAQmxCreateCOPulseChanTime (gTaskHandle, "Dev1/ctr1", "", DAQmx_Val_Seconds, DAQmx_Val_Low, 3.0, 4.0, 4.0);
    DAQmxCreateCOPulseChanTime (gTaskHandle, "?????", "", DAQmx_Val_Seconds, DAQmx_Val_Low, 7.0, 8.0, 8.0);
    DAQmxCfgImplicitTiming (gTaskHandle, DAQmx_Val_FiniteSamps, 5);
    DAQmxStartTask (gTaskHandle);
    DAQmxWaitUntilTaskDone(gTaskHandle)
    DAQmxErrChk DAQmxStopTask(gTaskHandle)
    DAQmxErrChk DAQmxClearTask(gTaskHandle)
    I believe this code should generate the 3 TTL square waveforms that I want for my application.
    Please provide me with some feedback.  It would greatly be appreciated.
    Thank You

     Hi,
    The NI 6034E is a multifuntion DAQ device, this means you have:
      (2) counters
      (8) DIO lines (software timed)
      (16) AI, single ended
      (0) Analog Output
     You have a couple choices here:
       1. Software timed digital output of all three signals, max 1khz loop rate, non-deterministic.
       2. Hardware timed digital output of 2 signals, max 20Mhz.
       3. Hardware timed digital output of 2 signals and software timed digital output of 1 signal.
       4. Find another NI MIO board such as the NI 6251. This board will do 10Mhz pattern generation for (8) DIO lines.
    For the hardware connection, you are correct, the output for the counters will be taken from pin 2 & pin 40.  Here's the pinout for the NI 6034E for reference:
    The output of the Counters can be routed to some of the PFI's or to the RTSI connector. You can see this in MAX
    Message Edited by Matthew W on 11-19-2007 01:24 PM
    Attachments:
    2007-11-19_131609.jpg ‏61 KB
    2007-11-19_132435.jpg ‏86 KB

  • How to generate a pulse train with different pulse width and delay?

    How to generate a triggered pulse train with different pulse width. for example, after each trigger signal, let's say 2 ms, then the counter output a pulse with pulsewidth of 1 ms, and then after 3 ms delay after the first pulse, the second pulse was generated with a pulse width of 4 ms.  Next cycle when the trigger signal comes, the same two pulses will be generated and so on. Is it possible to achieve this by using 6601 counter card? and if yes, how to achieve this? Thanks!

    Unfortunately you can not create a hardware timed pulse train with different widths on each pulse from a counter. Whilst it can be changed on the fly using software, since you require a hardware triggered signal getting the software involved will not give a huge amount of accuracy when the pulse will actually change.
    So in short you can't use your 6601 card (or a counter timer) to achieve this
    There are three possible Alternative solutions
    1 You could use a high speed digital IO device such as the (6533/34) to generate your variable signal which would require setting up the pulse train as a series of states based around the burst transmission mode where the clock would give you your specific timing.
    2 A timed analogy output (for example on a MIO card with a clock (PCI-6220 / 62xx), i.e. Not the 6704 style static analogy output cards)
    3 A high speed digital waveform card such as the (, 656x , 655x, 654x, 6534, 6533 (http://www.ni.com/modularinstruments/find_right.ht​m) ) this could then be scripted to work with your triggering and also there is a digital waveform editor which will enable you to set up the pattern you wish to generate (http://sine.ni.com/nips/cds/view/p/lang/en/nid/135​55) 
    Hope that helps
    Tim Matthews
    NI (UK)

  • BI Answers - need 2 compound layouts with tables with different columns

    Hi,
    I need 2 tables in the same report with different columns displaying. Is this possible?
    I wanted to put them in their own compound layout and call each one with a view selector,
    but it seems impossible to create a 2nd table with different columns in the one report.
    Each time I try and replace one of the columns in the 2nd table with a different column,
    a message appears saying the deleted column will be deleted from all views.
    Many thanks for anyone's help.
    - Jenny

    As per my knowledge - your requirement can be done with Pivot view but not with regular table view.
    We dont have exclude column - functionality in table view.
    Else, instead of creating in same report create the req. with 2 separ. reports but place them on single dashboard in 2 sep. sections.

  • Design a single template for multiple reports with different column order

    Hi,
    I need to migrate the existing reports from SQL Server Reporting Services to Crystal Report 2008, and the column order in the report is very important to the clients since clients have existing code to ingest these reports into their database. Now I want to create a single template with lot of parameters for all reports. My question is how I might use one template to create multiple reports with different column orders in the reports?
    For example, client A has the following column order in their report: firstName, LastName, DateBirth, SSN. Client B has the following column order in their report: SSN, DateBirth, LastName, FirstName. Can I use one template to create these multiple reports?
    Thanks in advance.

    -As I mentioned you can find Template Field object in Insert menu of crystal report Designer 2008.
    As soon as you select Template Field object you will be able to see a box beside ur mouse cursor. Drag and drop this box at required place. Now when you place this object in report you will get some thing like this "<TemplateField1>" listed under Formula Fields tree. Double click "<TemplateField1>" formula to add your conditions.
    -I have not tested it for large amount of Customers. However as the number of customer increases the number of conditions will get increased.
    For the customer that want the same ordering of columns you can put those customers under one condition.
        for Example...
              if(?Client in ['clientA','clientA']) then
                        <TableName>.<Field>......
    -What do you mean be 40 columns? Do you mean 40 fields or you want to show 40 columns in report? Please elaborate.
    Regards,
    Amrita
    Edited by: Amrita Singh on May 21, 2009 7:54 AM

  • Many to many join table with different column names

    Hi have a joint table with different column names as foreign keys in the joining
    tables...
    e.g. i have a many to many reltnshp btwn Table A and Table B ..and join table
    C
    both have a column called pk.
    and the join table C has columns call fk1 and fk2
    does cmd require the same column name in the join table as in the joining table?
    are there any workarounds?
    thanks

    HI,
    No, the foreign key column names in the join table do not have to match the primary
    key names in the joined tables.
    -thorick

  • Grid with fixed column widths

    Hi Folks,
    I have a grid in which I want to prevent the user to move the set column widths, because this grid has a separate graphik on top of it which would then cease to correspond with the grid columns.
    My question: is there any means of difining a grid with <u><b>non-resizeble columns</b>?</u>
    Thanks & Regards
    Fouad
    Message was edited by: Fouad Sebbane

    Hi
    In the below structure ,set bold field as 'X' for columns u wish to keep fixed.
    Fieldcat
    types: begin of slis_fieldcat_main0,
             row_pos        like sy-curow, " output in row
             col_pos        like sy-cucol, " position of col
             fieldname      type slis_fieldname,
             tabname        type slis_tabname,
             currency(5)    type c,
             cfieldname     type slis_fieldname, " currency
             ctabname       type slis_tabname,   " and table
             ifieldname     type slis_fieldname, " initialcol
             quantity(3)    type c,
             qfieldname     type slis_fieldname, " qty
             qtabname       type slis_tabname,   " and table
             round          type i," round in write statement
             exponent(3)       type c,  " exponent for floats
             key(1)         type c,   " column with key-color
             icon(1)        type c,        " as icon
             symbol(1)      type c,        " as symbol
             checkbox(1)    type c,        " as checkbox
             just(1)        type c,  " (R)ight (L)eft (C)ent.
             lzero(1)       type c,        " leading zero
             no_sign(1)     type c,        " write no-sign
             no_zero(1)     type c,        " write no-zero
             no_convext(1)  type c,
             edit_mask      type slis_edit_mask,            
             emphasize(4)   type c,        " emphasize
       <b>fix_column</b>(1)   type c,       " Spalte fixieren
             do_sum(1)      type c,        " sum up
             no_out(1)      type c,   " (O)blig.(X)no out
             tech(1)        type c,        " technical field
             outputlen      like dd03p-outputlen,
             offset         type dd03p-outputlen,     "offset
             seltext_l      like dd03p-scrtext_l, " long key
             seltext_m      like dd03p-scrtext_m, " middle
             seltext_s      like dd03p-scrtext_s, " short
             ddictxt(1)     type c,        " (S)hort (M)
             rollname       like dd03p-rollname,
             datatype       like dd03p-datatype,
             inttype        like dd03p-inttype,
             intlen         like dd03p-intlen,
             lowercase      like dd03p-lowercase,
           end of slis_fieldcat_main0.
    Regards,
    Raj

  • Sum of field in different columns according to dates

    Hi Gurus
    I have a table s903 with
    Type Declaration
                          data:
                          begin of ty_S903 occurs 0,
                             fkdat   like s903-fkdat, " billing date 
                             pkunag  like s903-pkunag," sold to party
                             fkimg   like s903-fkimg, " actual invoice quantity
                             werks   like s903-werks, " plant
                          end of ty_S903.
    DATA: it_s903 type standard table of ty_903,
          wa_s903 type ty_903.
    I need to calculate SUM(s903-fkimg) for different dates   (s903-fkdat)
    The columns are sold to party |JAN, FEB, MAR, APR ....   .
    I need to display report as SUM(S903-FKIMG) for JAN in first column,FEB in second, MAR in third , APR in fourth and so on ...........as I select the date range from fkdat
    how can I proceed Is there any clue to do so?
    do i need to use collect here?
    Can you please help me how to do this?
    Thanks in advance.
    Piroz

    Hi,
    If your table is based on a view object then you can use a transient attribute and in its value use a groovy expression.
    the new attribute should have:
    value type: "expression"
    value: object.getRowSet().sum('AmountAttribute')"
    Drag and drop the new attribute from the data sources to your page and add partialTriggers from the components that affect it
    (Insert/Delete buttons and the table field that it sums).
    Gabriel.

  • Spark DataGrid with Dynamic Column Width

    Lets suppose I have a Spark Datagrid with no explicit typicalItem. When the Datagrid is initialized, the column widths are calcualted correctly based on the contents of the dataprovider. However if I add/remove an item from the dataprovider, or modify the one of the objects in the dataprovider, the column widths never update to reflect the change. Is the the correct behavior for a DataGrid? If so, is there any method I can call to force the DataGrid to recalculate and redraw the column widths?

    When Spark DataGrid doesn't have a typicalItem, it uses the first dataProvider item as the typicalItem.  If you change that, the DataGrid won't pick it up immediately. You can invalidate the current typicalItem using dataGrid.invalidateTypicalItem().

  • Stuck - load the Excel file dynamically with different columns and worksheet names

     I have a situation where I want to load the Excel file dynamically, and the excel file have different columns or even worksheet name. Any idea how I could
    approach this? I believe there's no way to modify the meta data (specifically the mapping) in the data flow.

    Hi Chimumu,
    The SSIS stock adapters don't supporting dynamic column mapping, to achieve your goal, you need to use Script Task/Component to read the Excel sheet name and the columns in the worksheet, and then map to the output columns of the script component. You can
    also refer to the following blogs:
    http://micktechblog.blogspot.com/2011/06/ssis-excel-import-with-unknown-number.html
    http://wikiprogrammer.wordpress.com/2011/04/08/dynamic-column-mapping-in-ssis-part-1/
    Regards,
    Mike Yin
    TechNet Community Support

  • Passing data to different internal tables with different columns from a comma delimited file

    Hi,
    I have a program wherein we upload a comma delimited file and based on the region( we have drop down in the selection screen to pick the region).  Based on the region, the data from the file is passed to internal table. For region A, we have 10 columns and for region B we have 9 columns.
    There is a split statement (split at comma) used to break the data into different columns.
    I need to add hard error messages if the no. of columns in the uploaded file are incorrect. For example, if the uploaded file is of type region A, then the uploaded file should be split into 10 columns. If the file contains lesser or more columns thenan error message should be added. Similar is the case with region B.
    I do not want to remove the existing split statement(existing code). Is there a way I can exactly pass the data into the internal table accurately? I have gone through some posts where in they have made use of the method cl_alv_table_create=>create_dynamic_table by passing the field catalog. But I cannot use this as I have two different internal tables to be populated based on the region. Appreciate help on this.
    Thanks,
    Pavan

    Hi Abhishek,
    I have no issues with the rows. I have a file with format like a1,b1,c1,d1,e1, the file should be uploaded and split at comma. So far its fine. After this, if the file is related to region A say Asia, then it should have 5 fields( as an example). So, all the 5 values a1,b1..e1 will be passed to 5 fields of itab1.
    I also have region B( say Europe)  whose file will have only 4 fields. So, file is of the form a2,b2,c2,d2. Again data is split at comma and passed to itab2.
    If some one loads file related to Asia and the file has only 4 fields  then the data would be incorrect. Similar is the case when someone tries to load Europe file with 5 fields related data. To avoid this, I want to validate the data uploaded. For this, I want to count the no. of fields (seperated by comma). If no. of fields is 5 then the file is related to Asia or if no. of fields is 4 then it is Europe file.
    Well, the no. of commas is nothing but no. of fields - 1. If the file is of the form a1,b1..e1 then I can say like if no. of commas = 4 then it is File Asia.But I am not sure how to write a code for this.Please advise.
    Thanks,
    Pavan

  • Mailboxes with different column headings

    This question was somewhat covered in 2006-2007 but not recently. I would like to set different column headings for certain mailboxes in Mail. I understand that the Inbox folder keeps a "logical" set of columns (From and not To, for example). The folder Sent also behaves the same. But I have organized most of my Received messages in a folder which then has subfolders for each company or person or sets of persons. I also organized my Sent messages in separate into a Mailbox called Sent Messages with appropriate subfolders/mailboxes. I would like to keep all of the Mailboxes that "receive messages" with certain columns (such as From and not To) and the "sent messages" with a different set of columns (To instead of From, Date Sent instead of Date Received, etc...). But I cannot do that in Mail 5.3 running on MacOS 10.7.5 . Is there a solution to achive these settings permanently?
    Thanks for any suggestion.

    Hello, I see this is an old post but is marked as solved. Did you find a way to do this? I've been looking for a way but to no avail.
    thanks
    -Pete

Maybe you are looking for

  • How to use desktop internet in iphone using usb cable

    I want to use my desktop internet connection in iphone using usb...if it is possible then let me know the way...

  • Total no of records in a recordset?

    I creating an application in which I send a query to database. Then loop through the ResultSet object and increment a counter to find the total no. of records in it, and then a generate JLabel array equal to the size of counter which is application's

  • How to use an Applet with multiple-jars

    Hi everybody, I would like to use an applet with multiple-jars. ex: <applet codebase="." archive="main.jar,Addon1.jar,Addon2.jar" code="Appl.class" id="MyTest" width="600" height="30">      <param name = "MyParam" value = "1;2"> </applet> An applet w

  • Artwork not staying

    Using itunes 8 on winXP SP3 and iPhone 3g with 2.1 software. I subscribe to some podcasts that iTunes does not have in it's store. Some of these podcasts do not have artwork although iTunes does offer it in it's store. This is not the big problem rig

  • Safari Address Bar - Leopard

    Seems to be an issue since upgrading to Leopard. When going to a page you have never been to before (for instance Google) you could type in google and hit enter. Safari would search the domains and open http://www.google.com/. Since the upgrade, I ty