Collect only columns that have values

I have one Collection called Collection1 with the following columns:
First
Last
Company
I'd like to collect that information into another collection, but only the columns that have data in them.   I can do it using multiple If statements for each column If(IsEmpty()), but this can create a LOT of If statements if I'm using a lot of
columns, rather than just the 3 in the example.
Is there a way to evaluate each column, and only collect it if it isn't empty without having to type out each column name in an If statement?
-Bruton

Hello Oliver,
Thanks for your help.  In that example, I would like:
First          Last           Company
John                            Contoso
                 Smith         Contoso2
Brad          Anderson
What I'm looking for how to do is if I have:
First          Last          Company
John          Smith         <empty>
Bruton       Gaster        <empty>
Barry         Manalo        <empty>
I want to collect First and Last, but if I have:
First          Last           Company
Scott          <empty>   Acumen
Bill             <empty>   Microsoft
Fred           <empty>   Dell
I want to collect First and Company.  The Column names may be based off variables, so I'd rather not have to throw a bunch of If statements at it, but if I have to, I have to.
Thanks!
-Bruton

Similar Messages

  • Column that have index

    I need to know what columns that have "ID%" and are NOT NULL from my user "TESTE" dont have a index. I used something like:
    select owner, table_name, index_name from dba_indexes where owner='TESTE' and table_name in (
    select table_name from ALL_TAB_COLUMNS where owner='TESTE' and COLUMN_NAME like 'ID%' and NULLABLE like 'N')
    But this give what columns have, i need the opposite.
    Tks,
    Elber.
    Message was edited by:
    Elber

    Although Sundar's solution may work in your particular case, it may be innacurate if more than one table could have a column with the same name. Fortunately, the fix for that also give you the table name "for free"
    SELECT table_name, column_name
    FROM all_tab_columns
    WHERE owner='TESTE' and
          column_name LIKE 'ID%' and
          nullable LIKE 'N'
    MINUS
    SELECT table_name, column_name
    FROM all_ind_columns
    WHERE index_owner='TESTE' and
          column_name LIKE 'ID%'You could also just add table_name to the select list of Kedruwsky's solution.
    One thing you may want to keep in mind is that both Sundar's and Kedruwsky's solutions, and my modification of Sundar's only check to see if the column is present in an index. It could be the fifth column in a seven column index.
    Depending on what exactly you are looking for, you may want to consider the column_position field in all_ind_columns. If you modify the parts of the queries against all_indexes to include a predicate like:
    column_position = 1it will eliminate only those columns that are on the leading edge of the index. Based on the ID% name, I suspect that you might be looking for primary keys. If that is true, you might want to replace the queries against all_ind_columns with a query against a join of all_constraints and all_cons_columns. Something like:
    SELECT table_name, column_name
    FROM all_tab_columns
    WHERE owner='TESTE' and
          column_name LIKE 'ID%' and
          nullable LIKE 'N'
    MINUS
    SELECT table_name, column_name
    FROM all_constraints c, all_cons_columns cc
    WHERE c.constraint_name = cc.constraint_name and
          c.constraint_type = 'P' and
          c.owner='TESTE' and
          cc.column_name LIKE 'ID%' and
          cc.position = 1HTH
    John

  • Smart collection of images that have been printed

    I'd like to create a smart collection of images that have been printed.  Is there any way to do this?  If not, is there a way to search for images that have been printed?
    Separately, one my smart collections screens by edit date so that I can find out what I have worked on recently.  However, it also picks up everything I shot and imported recently, even if I haven't edited the images.  Is there any way to filter these out?
    I'm using LR 5.3 for Windows.
    Thank you,
    Robert

    Here's how I get there.  This filters images that have had Develop adjustments within the last three weeks. 

  • How to clear only blocks which have values

    Hi there,
    Is there anyone knows how to clear data from blocks which only have values ? so the idea, i dont have to create any new block by using something like set a block to be #MI ?
    Please advice. Thanks a lot
    R'gards
    Octoni

    From Technical Reference
    The CLEARDATA command clears a well-defined section of a database's cells and changes the values of those cells to #MISSING values. This command is useful when you need to clear existing data values before loading new values into a database. CLEARDATA can only clear a section of a database. It cannot clear the entire database.

  • Are Apple products the only ones that have the option to have a hot spot built into i?

    my husband needs to use a tablet for work. We don't have an Internet provider for it. I thought about using a personal hot spot for it. I have 2 Apple products he doesn't have any. Can you use a personal hotspot for them. I am not familiar with his products at all. Is Apple the only one that offers a hotspot on their products?

    No. Click here and see the third paragraph.
    (120029)

  • Extract only records that have difference sum

    Hi all. I'm on oracle 10g.
    I have a question. I have two select statement, both with sum function.
    I want that from first select I must retrieve only records which have different sum.
    Here is the code:
    first select statement
    select a.codice_contratto codice_contratto, a.codice_qualifica codice_qualifica,
    a.codice_istituzione codice_istituzione, sum(a.nume_dip_tot) tot, sum(a.nume_dip_donne) donne
    from tn_bz_t_10 a
    where a.anno = 2006
    group by a.codice_contratto, a.codice_qualifica, a.codice_istituzione
    order by a.codice_contratto, a.codice_qualifica, a.codice_istituzione
    secon select statement
    select codice_contratto, codice_qualifica,
    codice_istituzione,
    sum(nume_dip_tot17) tot, sum(nume_dip_donne17) donne
    from tabella10
    where anno = 2006
    and versione = 'D'
    and nume_dip_tot17 <> 0
    group by codice_contratto, codice_qualifica, codice_istituzione
    order by codice_contratto,codice_qualifica,codice_istituzione
    My goal is that from first select I must retrieve only those records which have difference sum, tot or donne,
    from second select...
    How can I achieve that??
    Thanks all for collaboration,
    Fabrizio Delli Priscoli
    Edited by: Fabrizio Delli Priscoli on 23-set-2010 14.25

    Hi, Fabrizio,
    (1) an inner join, or
    (2) NOT IN
    are two ways that will probably be efficient.
    You've been using this forum for nearly 9 years, so you know that, to get a more detailed answer, you need to post a more detailed question.
    Post a little sample data (CREATE TABLE and INSERT statements) and the results you want from that data.
    Format your code and results, and post them between \ tags to keep this site from removing the extra spaces.
    Always say what version of Oracle you're using.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Returning only records that have no entry in a specific field

    Hello,
    I'm new to this forum and relatively new to Crystal Reports, so I apologize if this information is "plain as day" somewhere.  I've been hunting for this info for quite a while and can't find anything that makes sense!
    I am trying to put together a very simple report that will return only records where a certain field is blank.
    It is an Access database, in an information management program specific to our type of business.  CR 11 software was included with the LIMS (Laboratory Information Management System), as the reports generated from the LIMS software are in CR.  I've learned enough to be able to tweak reports and make some basic reports, but I can't find a simple answer to what I think is a simple question! 
    I have the report set up to access the following fields in the database:  Invoice number, Client name, Due date, Invoice amount, and Payment Received.  This will be used as a "cross check" - not as any major accounting tool - as the Payment Received field is simply the date that the payment was received.  If no payment has been received, the field is left blank.
    I want the report to return ONLY those records where that field is blank (i. e. a list of invoices/clients whose payment has not yet been received).
    Ideally, I would also like to be able to return only those records where that field is blank OR within a certain date range (i. e. less than 30 days from the date that the report is run).  However, we'll probably only use this report a couple of times a month, so that is not as critical.
    I know I need to filter the records according to the Payment Received field, but don't know how to construct a formula that says "just show the fields where there is nothing entered."
    Thank you!
    Brenda

    This is the hardest function to find:  IsNull
    If isNull(field) then  
        //  if the above fails on a numberic field or text field then see the following two-some databases are picky.
    If IsNull(field) or field=0 then  //this one maybe needed for a numeric field
    If IsNull(field) or field=""    //  this one maybe needed for a text field
    if IsNull(field) or field=<value>
    or
    if IsNull(field) or field like <value*>
    You always want the IsNull statement to be the first statement, and it is especially usefull when testing for not equal
    If IsNull(field) or field <>  <value>

  • Once more - tabular form / update only rows that have changed

    I know it's been asked before, but I haven't seen an answer I like. :-)
    I have a query that includes a single column the user can update, using APEX_ITEM.TEXT(10, updateable_field, 10, 10)
    I have an additional APEX_ITEM.HIDDEN(21) and APEX_ITEM.HIDDEN(22) that hold the two fields of the composite primary key. In order to track whether my updateable_field had changed, I created APEX_ITEM.HIDDEN(11, updateable_field), which I expected would hold the OLD value of the field. See where I'm going with this? :-)
    I'm attempting to loop through apex_application.g_f21, get the values for F10 (new) and F11 (old) and compare them. If they're different, I'll do the update.
    It works fine if the old value (F11) is empty and I plug in a new value (to F10).
    But if I change a field that had already has a value (in F11) and make it NULL, I notice that F11(i) doesn't exist. In that case, I set the value to NULL, and the compare fails because it thinks the row is unchanged.
    Can someone suggest or point me to an alternate method that works?
    Thanks as always,
    Stew

    Mike,
    Thanks for the suggestion, which is a good one. But I had that one covered.
    I have it working now, and I believe the fix was that I moved the APEX_ITEM.HIDDEN that contained the old value in the query. I'd had it concatenated with the column for the new value (which used APEX_ITEM.ITEM). I changed it to concatenate to a plain string value. And now the array has values in it, which I can properly compare.
    Thanks again. That was really driving me nuts!
    Stew

  • Deleting depreciation areas that have values

    Hello:
      We have several tax depreciation areas with values that are no longer needed.  The straight forward solution seems to be just to delete the depreciation areas.  However, I did see some documentation stating that cannot be done.   So, can depreciation areas with values be deleted?
          Jeff

    Hi
    You have the answer in your question itself.
    Regards
    KVKR

  • How to use RichCopy to copy only files that have changed?

    I am using RichCopy to copy files and folders from one system to another on a weekly basis.  RichCopy is working fine, but it is copying 100% of the data every time.  I am looking for a way to use RichCopy where it will compare files/folders from
    the source and only copy what data has changed to the destination.  I cannot find the option to do that.
    Any help would be greatly appreciated...
    Thank you.

    RichCopy is not a Windows 7 feature and it is an obsolete utility and there is no support for RichCopy.
    Info found @ http://en.wikipedia.org/wiki/RichCopy
    RichCopy is not supported by Microsoft.<sup class="reference" id="cite_ref-technet200904_1-1">[1]</sup> The program has
    not been updated since approximately June 2009, despite numerous users requesting for bug fixes.<sup class="reference" id="cite_ref-4">[4]</sup>
    Duplicates functionality already in
    Robocopy
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”

  • How can I define that the value of a column should always be in UPPER case

    Hi,
    I want to make sure that the value in a column is always in UPPER case.
    Can we give this condition while creating or altering a table.
    A trigger can do it easily, but I was wondering if we could define a column to have values with upper case all the time, independent of what values are inserted. I mean if we give a lower case value in the insert statement, it should be converted automatically to upper case & stored.
    I want something like
    Alter table MY_TABLE Modify ( col1_upper varchar2(25) default UPPER(Col1_upper));
    But the above statement does not work as it references the col of the table.
    Thanks
    Sunil

    Well, you can put a check constraint on to prevent someone from putting lowercase data in:
    alter table my_table add constraint my_table_check_upper check (col1_upper = upper(col1_upper));However, I know of no way to modify the data being inserted/updated in a table without a trigger.
    Richard

  • Counting Numnber of Cells in a Table that Have the Same Value

    Is there a way/formula to do this, other than they way I'm doing it now, which is by using COUNTIF? In a table with 1000 rows for instance, let's say the values in the A column are what I'm keying off. I would like a count of all the cells in the A column that have the word "example" as their value. Right now for each unique value in a cell in the A column I am manually creating a COUNTIF(A1:A1000,"<value i'm matching against>) but if there are many unique values in the A column, it's quite laborious. Ideally I'd like to just have a table generated that gives me the top 5 or top 10 most occurring cell values in the A column in the table. What's the best way to do this?

    So for instance, for a column like this:
    1
    1
    1
    2
    2
    4
    5
    I want a way to get back the number of times 1 appears in the list (3), the number of times 2 appears in the list (2), 4 (1), 5 (1), and so on. If I do a COUNTIF and there are thousands of rows, I have to manually put the matching string in each one.

  • Filtering a Power Query Table Based on a Column That's a Table

    I have a table produced by an outer join ... 
    "Bananas" is not one of [My Fruit] values.  I'd like to filter my join results to only include [My Fruit] values, and I thought I could do that without expanding "NewCol".
    Am I mistaken in my belief that such a selection can be done without expanding the "NewCol"?

    hi Mark Weisman,
    I suppose your [My Fruit] value is single values. You can try below :
     Table.SelectRows( Join1,  each  List.Contains( [NewCol] [Fruit] , [My Fruit] ) )
    Note: [Fruit] is the column that contain value want to filter.
    Below is my testing sample :
    let
        Source = Table.FromRows({ {"North", "Apples"}, {"North", "Orange"}, {"West", "Bananas"},{"West", "Lemon"}}, {"Region", "Fruit"}),
        Group = Table.Group(Source, {"Region"}, {{"NewCol", each _, type table}}),
        Select = Table.SelectRows( Group, each List.Contains( [NewCol] [Fruit] , "Lemon" ) )
    in
        Select
    Regards,

  • Placeholder column's "initial value"

    Hello,
    I have a report with 2 queries, the master query contains some placeholder columns, and the detail query contains a formula column that sets values for these placeholders:
    - MASTERQUERY: database columns, PlaceHolder1, PlaceHolder2, PlaceHolder3
    |
    |
    -- DETAILQUERY (linked to MASTERQUERY): database columns, CF_PlaceHolder_Changer (change values of PlaceHolderX)
    The problem is: for a particular record of MASTERQUERY, if the DETAILQUERY doesn't have any row then PlaceHolders are not set.
    (They will keep the values from previous MASTER record). Is there any way that I can specify "initial value" for placeholder columns?
    And another question: what is the formula attached to the placeholder used for?
    Please help!

    You could have a "count" column in the master group that determines how many rows are in the detail group. Then alter the value of the field displaying the placeholder value by adding a format trigger with srw.set_field_char/date/number(0, <initial value>); when the count is '0'.

  • Selecting columns which have data in it

    I have tables with more than 300 columns and most of the columns does not contain any data. Could anyone suggest a sql statement to select only those columns which has data atleast for one of the rows ?
    Thanks,
    Sachin
    null

    The following script combines some of the ideas from the responses above, so that all you should need to do is run this one script to select the data from only those columns that have data in at least one row, skipping the columns that don't have data in any of the rows.
    The script will prompt you for the name of the table for which you want to select the columns. Then it will analyze that table, which will update the num_nulls column of the all_tab_columns table regarding your table. Then it will use that information to select the proper columns which will be spooled to another file called list_not_nulls2.sql.
    The file list_not_nulls2.sql that this script creates will contain the select statement that will include only the not null columns that you are looking for. The script will then automatically run that script containing the select statement for you.
    Please let me know if you have any difficulties using or understanding it.
    Barbara
    SET ECHO OFF
    SET FEEDBACK OFF
    SET HEADING OFF
    SET PAGES 0
    SET TIMING OFF
    SET VERIFY OFF
    ACCEPT name_of_table PROMPT 'Enter name of table: '
    SET TERMOUT OFF
    ANALYZE TABLE &name_of_table COMPUTE STATISTICS
    SPOOL list_not_nulls2.sql
    SELECT 'SELECT '
    FROM DUAL
    SELECT COLUMN_NAME &#0124; &#0124; ','
    FROM ALL_TAB_COLUMNS
    WHERE TABLE_NAME = UPPER ('&name_of_table')
    AND NUM_NULLS <> (SELECT COUNT (1) FROM &name_of_table)
    AND COLUMN_ID < (SELECT MAX (COLUMN_ID)
    FROM ALL_TAB_COLUMNS
    WHERE TABLE_NAME = UPPER ('&name_of_table')
    AND NUM_NULLS <> (SELECT COUNT (1) FROM &name_of_table))
    SELECT COLUMN_NAME
    FROM ALL_TAB_COLUMNS
    WHERE TABLE_NAME = UPPER ('&name_of_table')
    AND NUM_NULLS <> (SELECT COUNT (1) FROM &name_of_table)
    AND COLUMN_ID = (SELECT MAX (COLUMN_ID)
    FROM ALL_TAB_COLUMNS
    WHERE TABLE_NAME = UPPER ('&name_of_table')
    AND NUM_NULLS <> (SELECT COUNT (1) FROM &name_of_table))
    SELECT 'FROM ' &#0124; &#0124; '&name_of_table' &#0124; &#0124; ';' FROM DUAL
    SPOOL OFF
    SET ECHO ON
    SET FEEDBACK ON
    SET TERMOUT ON
    SET VERIFY ON
    START list_not_nulls2
    null

Maybe you are looking for