Where-Object filtering using an array

Greetings! Trying to use Where-Object to filter out the returned data from Get-ChildItem. I essentially want to include everything that matches "Microsoft Lync Server". This works fine for matching "Microsoft Lync Server", but I can't
seem to figure out the syntax to exclude those that match anything in the array.
$filter = @("Debugging Tools","Resource Kit Tools","Best Practices Analyzer","Meeting Room Portal")
(Get-ChildItem HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall | ForEach-Object {Get-ItemProperty $_.pspath} | Where-Object {$_.DisplayName -imatch "Microsoft Lync Server"}) | Select-Object DisplayVersion,displayname | Sort-Object DisplayVersion -Descending
I've tried using something like
(Get-ChildItem HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall | ForEach-Object {Get-ItemProperty $_.pspath} | Where-Object {$_.DisplayName -imatch "Microsoft Lync Server" -and $_.DisplayName -notin $filter}) | Select-Object DisplayVersion,displayname | Sort-Object DisplayVersion -Descending
As well as -notcontains -notmatch, etc. to no avail. Ideas?

Not quite. The requirement is to list ALL with a display name that includes "Microsoft Lync Server" EXCEPT those in the filter. Your first example gave JUST the stuff in the filter. Changing it to -inotmatch now shows EVERYTHING (including stuff other than
"Microsoft Lync Server") except what's in the filter. But, I was able to adapt it to:
$filter = @("Debugging Tools","Resource Kit Tools","Best Practices Analyzer","Meeting Room Portal")
[regex]$regex = ‘(‘ + (($filter |foreach {[regex]::escape($_)}) –join “|”) + ‘)’
(Get-ChildItem HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall |
ForEach-Object {Get-ItemProperty $_.pspath} |
Where-Object {$_.DisplayName -imatch "Microsoft Lync Server" -and $_.DisplayName -inotmatch $regex}) |
Select-Object DisplayVersion,displayname |
Sort-Object DisplayVersion -Descending
Thanks for the info, as it kept most of my original syntax, and wasn't full of aliases.

Similar Messages

  • BOMM - metadata manager repository sql to fetch where object is used in rep

    Hi,
    We've been using BOMM for a few months and would now like to make our own reporting on the BOMM repository. Most information we're capable of retrieving, but not wether a certain universe object is used in the select-clause or where-clause of a reportquery. The information must be stored somewhere, because the mm explorer is can give us that information.
    Can someone tell me where this information is stored and how we can get it out?
    I thought it was stored in the table MMD_Query, with query_type_cd = sqls or sqlw. But the table only contains the full sql (sqlf), universe contexts (unvc) and join statements (sqlj).
    Thanks in advance for the help. Regards
    Guy
    Ps: My excuses for the crossposting, but I was advised to put this question in this forum.

    You might have better luck in the (somewhat misnamed) [Data Integration and Data Quality Management|Data Services and Data Quality; forum:
    This forum is dedicated to topics related to SAP BusinessObjects Data Services (Data Integrator, Data Quality Management, Text Data Processing), SAP BusinessObjects Information Steward (Metadata Management, Data Insight), SAP BusinessObjects Rapid Marts and SAP BusinessObjects Data Federator.
    (emphasis added)
    Regards,
    Sean

  • Where do I use These lock object FM's (Enqueue & D? and How do I use them?

    I created lock object for user defined table (zconsist). The system automatically created 2 FM's (Enquiue & Dequeue).
    I created a new TCode and accessing this with mulitple users to do some updates and inserts in that above table.
    I used INSERT ZCONSIST statement in 5 places in my program (4 include programs).
    Where do I use These FM's? and How do I use them?
    I mean before inserting which FM I need to use? after immediately what fm used?.
    every insert statemnt before i need to use the respective fm? so 5 places i need to call the respective FM is it right?
    thank in advance.

    Hi Sekhar,
    Lock objects are use in SAP to avoid the inconsistancy at the time of data is being insert/change into database.
    SAP Provide three type of Lock objects.
    Read Lock(Shared Locked)
    protects read access to an object. The read lock allows other transactions read access but not write access to
    the locked area of the table
    Write Lock(exclusive lock)
    protects write access to an object. The write lock allows other transactions neither read nor write access to
    the locked area of the table.
    Enhanced write lock (exclusive lock without cumulating)
    works like a write lock except that the enhanced write lock also protects from further accesses from the
    same transaction.
    You can create a lock on a object of SAP thorugh transaction SE11 and enter any meaningful name start with EZ Example EZTEST_LOCK.
    Use: you can see in almost all transaction when you are open an object in Change mode SAP could not allow to any other user to open the same object in change mode.
    Example: in HR when we are enter a personal number in master data maintainance screen SAP can't allow to any other user to use same personal number for changes.
    Technicaly:
    When you create a lock object System automatically creat two function module.
    1. ENQUEUE_<Lockobject name>. to insert the object in a queue.
    2. DEQUEUE_<Lockobject name>. To remove the object is being queued through above FM.
    You have to use these function module in your program.
    check this link for example.
    http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
    tables:vbak.
    call function 'ENQUEUE_EZLOCK3'
    exporting
    mode_vbak = 'E'
    mandt = sy-mandt
    vbeln = vbak-vbeln
    X_VBELN = ' '
    _SCOPE = '2'
    _WAIT = ' '
    _COLLECT = ' '
    EXCEPTIONS
    FOREIGN_LOCK = 1
    SYSTEM_FAILURE = 2
    OTHERS = 3
    if sy-subrc 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    Normally ABAPers will create the Lock objects, because we know when to lock and how to lock and where to lock the Object then after completing our updations we unlock the Objects in the Tables
    http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
    purpose: If multiple user try to access a database object, inconsistency may occer. To avoid that inconsistency and to let multiple user give the accessibility of the database objects the locking mechanism is used.
    Steps: first we create a loc object in se11 . Suppose for a table mara. It will create two functional module.:
    1. enque_lockobject
    1. deque_lockobject
    before updating any table first we lock the table by calling enque_lockobject fm and then after updating we release the lock by deque_lockobject.
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
    GO TO SE11
    Select the radio button "Lock object"..
    Give the name starts with EZ or EY..
    Example: EYTEST
    Press Create button..
    Give the short description..
    Example: Lock object for table ZTABLE..
    In the tables tab..Give the table name..
    Example: ZTABLE
    Save and generate..
    Your lock object is now created..You can see the LOCK MODULES..
    In the menu ..GOTO -> LOCK MODULES..There you can see the ENQUEUE and DEQUEUE function
    Lock objects:
    http://www.sap-img.com/abap/type-and-uses-of-lock-objects-in-sap.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
    Match Code Objects:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/41/f6b237fec48c67e10000009b38f8cf/content.htm
    http://searchsap.techtarget.com/tip/0,289483,sid21_gci553386,00.html
    See this link:
    http://www.sap-img.com/abap/type-and-uses-of-lock-objects-in-sap.htm
    Check these links -
    lock objects
    Lock Objects
    Lock Objects
    kindly reward if found helpful.
    cheers,
    Hema.

  • Where we can use standard ODS Object and Trasactional ODS Object ?

    Where we can use standard ODS Object and Trasactional ODS Object ?

    Hi,
    In a standard ODS object, data is stored in different versions (active, delta, modified), whereas a transactional ODS object contains the data in a single version.  Therefore, data is stored in precisely the same form in which it was written to the transactional ODS object by the application. In BW, you can use a transaction ODS object as a data target for an analysis process. The transactional ODS object is also required by diverse applications, such as SAP Strategic Enterprise Management (SEM) for example, as well as other external applications.Transactional ODS objects allow data to be available quickly. The data from this kind of ODS object is accessed transactionally, that is, data is written to the ODS object (possibly by several users at the same time) and reread as soon as possible.
    It offers no replacement for the standard ODS object. Instead, an additional function displays those that can be used for special applications.
    Regards,
    R.Ravi

  • How to call a method using a array of that object?

    hey, another array question
    for example i have 2 classes one name class and a driver
    inside the name class i have method that gets the name
    public Name getName1( ) {return name1;}
    my question is if i created an array of Name objects in my driver with the following line
    Name [ ] n1 = new Name [ ] ;
    and i wanna call methods inside the name class using my array of Name that i created how do i do it?
    thanks in advance

    thanks for the reply Maxx
    another question regarding arrays
    for example if im doing an array of objects Name[ ] n1 = new Name [ ]
    and i have a method that removes the name if its the same as the user input
    if (n1[ i ].getName.equals(myName))
    / / if they equal it removes it,
    else,
    / / the n[ 1 ] stays the same
    ive search the forum for previous questions on this but their examples doesnt seems to work, can anyone help? also if end up using this remove method that checks the elements in n1 if it matches it will remove it what should i do to avoid nullpointerexceptions if i wanna shift it all down?
    thanks in advance

  • Where we can test the SAP objects by using eCATT?

    Hi Abapers,
    Where we can test the SAP objects by using eCATT?Is there any separate software or tool we have to install or its included in the SAP itself?
    I have ECC5.0 version?how can i configure or install eCATT?
    Please explain the step by step procedure?
    Early reply is highely appriciable.
    Regards,
    Chow.

    Hi
    Extended Computer Aided Test Tool (eCATT) to create and execute functional tests for software. The primary aim is the automatic testing of SAP business processes. Each test generates a detailed log that documents the test process and results.
    Features
    You can:
    · Test transactions and reports
    · Call BAPIs and function modules
    · Test remote systems
    · Check authorizations (user profiles)
    · Test database updates
    · Test the effects of changes to customizing tables
    · Test the effect of changes to customizing settings
    · Check system messages
    Constraints
    eCATT runs in a system based on SAP Web Application Server 6.20 or higher. However, you can use this system to test systems with Release 4.6C or higher.
    check these link,
    eCATT- An Introduction
    /people/sumeet.kaul/blog/2005/07/26/ecatt-an-introduction
    Creating Test Scripts
    /people/sumeet.kaul/blog/2005/08/10/ecatt-creating-test-scripts
    eCATT Logs
    /people/sapna.modi/blog/2006/04/18/ecatt-logs-part-vi
    eCATT Scripts Creation – TCD Mode
    /people/sapna.modi/blog/2006/04/10/ecatt-scripts-creation-150-tcd-mode-part-ii
    Creation of Test Data Container
    /people/sumeet.kaul/blog/2005/08/24/ecatt-creation-of-test-data-container
    eCATT Scripts Creation - SAPGUI Mode
    /people/sapna.modi/blog/2006/04/10/ecatt-scripts-creation--sapgui-mode-part-iii
    Integrating ECATT & MERCURY QTP Part -1
    /people/community.user/blog/2007/01/02/integrating-ecatt-mercury-qtp-part-1
    Using eCatt to Test Web Dynpro ABAP
    /people/thomas.jung/blog/2006/03/21/using-ecatt-to-test-web-dynpro-abap
    and
    -command reference
    http://help.sap.com/saphelp_nw04/helpdata/en/c6/3c333b40389c46e10000000a114084/content.htm
    /people/sapna.modi/blog/2006/04/10/ecatt--an-introduction-part-i
    http://prasadbabu.blogspot.com
    https://www.sdn.sap.com/sdn/developerareas/was.sdn?page=test_tool_integration_for_sap_e-catt.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/1b/e81c3b84e65e7be10000000a11402f/frameset.htm
    http://www.erpgenie.com/ecatt/index.htm
    hope this helps.
    Regards
    Anji

  • Re: Beginner needs help using a array of class objects, and quick

    Dear Cynthiaw,
    I just read your Beginner needs help using a array of class objects, and quick of Dec 7, 2006 9:25 PM . I really like your nice example.
    I also want to put a question on the forum and display the source code of my classe in a pretty way as you did : with colors, indentation, ... But how ? In html, I assume. How did you generate the html code of your three classes ? By help of your IDE ? NetBeans ? References ?
    I already posted my question with six source code classes ... in text mode --> Awful : See "Polymorphism did you say ?"
    Is there a way to discard and replace a post (with html source code) in the Sun forum ?
    Thanks for your help.
    Chavada

    chavada wrote:
    Dear Cynthiaw,
    I just read your Beginner needs help using a array of class objects, and quick of Dec 7, 2006 9:25 PM . I really like your nice example.You think she's still around almost a year later?
    I also want to put a question on the forum and display the source code of my classe in a pretty way as you did : with colors, indentation, ... But how ?Just use [code] and [/code] around it, or use the CODE button
    [code]
    public class Foo() {
      * This is the bar method
      public void bar() {
        // do stuff
    }[/code]

  • List of Routines where info object is used

    Hi all,
    I would like to list all routines where a info object is used. Can anybody tell me how do I do it in BW.
    Regards
    NPR

    RSTSRULES & RSTRANROUTMAP in SE16

  • Using an array in another class to set text of a button

    I am trying to use an array from one class in another to set the text of a button.
    This is the code in the class where i have made the array.
    public class EnterHomeTeam
         public int NumberOfPlayers = 11;
         public String[] PlayerName = new String [NumberOfPlayers];
    private void button1_Click (Object sender, System.EventArgs e)
              PlayerName [0] = this.HGoalKeeper.toString();
              PlayerName [1] = this.HDef1.toString();
              PlayerName [2] = this.HDef2.toString();
              PlayerName [3] = this.HDef3.toString();
              PlayerName [4] = this.HDef4.toString();
              PlayerName [5] = this.HMid1.toString();
              PlayerName [6] = this.HMid2.toString();
              PlayerName [7] = this.HMid3.toString();
              PlayerName [8] = this.HMid4.toString();
              PlayerName [9] = this.HAtt1.toString();
              PlayerName [10] = this.HAtt2.toString();     
              Players IM = new Players();
              this.Hide();
              IM.Show();
    }Then in the class where i want to use the variables (ie. PlayerName[0]) I have got
    public class Players
    EnterHomeTeam HT = new EnterHomeTeam();
    //and included in the button code
    this.button1.set_Text(HT.PlayerName[0]);I hope i have explained this well enough and hope someone can help me solve this problem! Im not a very competent programmer so i apologise if I havent explained this well enough!
    Adam

    .NET automatically generates quite a bit of code.... this is button1:
    private void InitializeComponent()
              this.button1 = new System.Windows.Forms.Button();
    // button1
              this.button1.set_BackColor(System.Drawing.Color.get_LightBlue());
              this.button1.set_Location(new System.Drawing.Point(88, 32));
              this.button1.set_Name("button1");
              this.button1.set_Size(new System.Drawing.Size(72, 56));
              this.button1.set_TabIndex(0);
              this.button1.set_Text(HT.PlayerName[0]);
              this.button1.add_Click( new System.EventHandler(this.button1_Click) );
    this.get_Controls().Add(this.button1);
         private void button1_Click (Object sender, System.EventArgs e)
              System.out.print(HT.PlayerName[0]);
              GKAction GK = new GKAction();
              this.Hide();
              GK.Show();
         }Hope that helps - im pretty sure that's all the button1 code

  • Trying to understand and use an Array

    I would like to have a game where the player has three tries before the game stops or moves on to another level.
    In this game an object jumps up with a mouseClick and if it doesn't hit it's target it falls where it crashes into a floor that uses hitTestObject.
    This leads to a  restartBtn. but I want that movieClip to remain on the stage, which has an animation that splatters. A new MovieClip is put on to the stage and the cycle starts over.
    Before this stage of the game s over I want the various movieClip splatters to be visible on the stage.
    I thought an Array would help me achieve this result but I'm not familiar with using them dynamically.
    I'm hoping someone can give me some tips as to what might work.
    I have temporarily separated this problem from the rest of the code as I'm hoping it will be clearer.
    This is where I left off and when I click the button it seems to eliminate the previous movieClip and introduce the next one.
    But it seems like I'm missing someting so I thought I would post it as it is probably a problem that comes up a lot in games. Thanks
    import flash.display.MovieClip;
    import flash.events.MouseEvent;
    var movieArray:Array = new Array();
    movieArray = ["Egg_A","Egg_B","Egg_C"];
    movieArray[0] = new Egg;
    movieArray[1] = new Egg_B;
    movieArray[2] = new Egg_C;
    var myMovieClip:MovieClip;
    init();
    function init()
              for (var i:int = 0; i < movieArray.length; i++)
                        emptyMC.addChild(movieArray[i]);
    mainBtn.addEventListener(MouseEvent.CLICK,changeEgg);
    function changeEgg(evt:MouseEvent):void
              for (var i:int = 0; i < movieArray.length; i++)
                        movieArray.splice(i,1);
              init();

    I don't see where an array is going to make anything remain.  Just having an instance created without removing it until you want it to go away is all you need.
    I don't see much reason with what you are doing with that array either.  First you assign a set of strings to it, then you replace those strings with instances of some Egg objects.  Then you add all the eggs to the display at once in your init() function (not one at a time), or you remove them all from the array with your change Egg function... calling the init() function after emptying the array isn't going to yield much since the init() function uses the array.

  • How to use Associative Array in sql query?

    Hello,
    I have a problem on using Associative Array variable on query; and my query is similar to the one below;
    TYPE OTHERGENERICS IS TABLE OF NUMBER(10) INDEX BY BINARY_INTEGER;
    othersGenerics OTHERGENERICS;
    CURSOR cursor_othersGenerics IS
    select master.GENERICCODEID
    from ASMTRG_ARTICLEMASTER master
    join ASMTRG_ARTICLEMAP map on MAP.ARTICLECODEID = MASTER.ID
    group by MASTER.GENERICCODEID
    minus
    select FGG.GENERICCODEID
    from asmtrg_icfocusgroup fg
    join asmtrg_icfocusgrpchannel fgc on FGC.GROUPID = FG.ID and fgc.isactive=1
    join asmtrg_icfocusgengroup fgg on FGG.GROUPID = FG.ID and FGg.ISACTIVE=1
    where fgc.channelid=1 and fg.isactive = 1
    group by FGG.GENERICCODEID;
    BEGIN
    OPEN cursor_othersGenerics;
    FETCH cursor_othersGenerics BULK COLLECT INTO othersGenerics;
    CLOSE cursor_othersGenerics;
    SELECT icfrd.*,
    CASE
    WHEN EXISTS(select ta.genericcodeid from <???XXX???> ta where ta.genericcodeid = icfgrp.genericcodeid) THEN -1
    ELSE icfrd.icfgroupid
    END CLASSIFICATION
    FROM ASMTRGVIW_ICFOCUSREPORTDATA icfrd
    LEFT JOIN ASMTRG_ICFOCUSGROUP icfgrp on icfrd.ICFGROUPID = icfgrp.ID
    WHERE (channelId IS NULL OR icfrd.CHANNELID = channelId)
    AND (asmCodeId IS NULL OR icfrd.ASMCODEID = asmCodeId)
    AND (yearId IS NULL OR icfrd.YEARID = yearId)
    AND (monthId IS NULL OR icfrd.MONTHID = monthId)
    END;
    By the way this is a part of my function.
    The "othersGenerics" is my associative array variable and <???XXX???> is the place where I need to use my "othersGenerics" array to check. So far I've tried
    "select ta.genericcodeid from table(cast(otherGenerics as OTHERGENERICS)) ta where ta.genericcodeid = icfgrp.genericcodeid",
    "select ta.genericcodeid from table(otherGenerics) ta where ta.genericcodeid = icfgrp.genericcodeid",
    "select ta.genericcodeid from otherGenerics ta where ta.genericcodeid = icfgrp.genericcodeid"
    and these are not working.
    What is your suggestions?

    Your type will have to be created as an independent object in your schema. So CREATE TYPE cannot be in your function declaration, it has to be outside it. (And then the line inside your declaration that defines the type will have to be removed.)
    But now I can see that you use this array as a kind of "temporary lookup table" - you populate the array and then use it for lookup in your select statement. An alternative way of doing this could be like this completely without arrays:
    with othergenerics as (
      select master.GENERICCODEID
      from ASMTRG_ARTICLEMASTER master
      join ASMTRG_ARTICLEMAP map on MAP.ARTICLECODEID = MASTER.ID
      group by MASTER.GENERICCODEID
      minus
      select FGG.GENERICCODEID
      from asmtrg_icfocusgroup fg
      join asmtrg_icfocusgrpchannel fgc on FGC.GROUPID = FG.ID and fgc.isactive=1
      join asmtrg_icfocusgengroup fgg on FGG.GROUPID = FG.ID and FGg.ISACTIVE=1
      where fgc.channelid=1 and fg.isactive = 1
      group by FGG.GENERICCODEID
    SELECT icfrd.*,
    CASE
    WHEN EXISTS(select ta.genericcodeid from othergenerics ta where ta.genericcodeid = icfgrp.genericcodeid) THEN -1
    ELSE icfrd.icfgroupid
    END CLASSIFICATION
    FROM ASMTRGVIW_ICFOCUSREPORTDATA icfrd
    LEFT JOIN ASMTRG_ICFOCUSGROUP icfgrp on icfrd.ICFGROUPID = icfgrp.ID
    WHERE (channelId IS NULL OR icfrd.CHANNELID = channelId)
    AND (asmCodeId IS NULL OR icfrd.ASMCODEID = asmCodeId)
    AND (yearId IS NULL OR icfrd.YEARID = yearId)
    AND (monthId IS NULL OR icfrd.MONTHID = monthId)
    ...The with clause (subquery factoring) you can think of as a kind of temp table called othergenerics created "on-the-fly".
    The optimizer may decide to actually create a temp table for you and use in the lookup, or it may decide to rewrite the query into suitable joins or nested loops or hashing - whatever the optimizer decides will be the optimal way of doing things :-)
    So unless you use your array other places in your function, I would recommend dropping the array completely, skip populating an array, and instead use a with clause for your temporary lookup.

  • Testing Object Equality using Serialization

    Hey everyone! I was wondering if somebody could help me figure out how to compare two objects using serialization.
    I have two objects that I'm trying to compare. Both of these objects extend a common "Model" class that has a method getSerialized() that returns a serialized form of an instance, shown below:
              // Serialize the object to an array
             ByteArrayOutputStream baos = new ByteArrayOutputStream(1000);
             ObjectOutputStream oos;
              try {
                   oos = new ObjectOutputStream(baos);
                  oos.writeObject(this);
                  oos.close();
              } catch (IOException e) {
                   e.printStackTrace();
             //Deserialize array into a String array
             return baos.toByteArray();This Model class also has an equals(Model obj) method that allows for the current model object to be compared to a model object that is passed in:
            //Store both models' serialized forms into byte arrays
            byte [] thisClass = this.getSerialized();
            byte [] otherClass = obj.getSerialized();This is where things get a little funny. The byte arrays don't equal - one array is a byte larger than the other. If a byte-by-byte comparison is done, the arrays are equal for the first 15-20% and then not equal for the rest. If I deserialize the byte arrays back into Models and do a toString() on those models, I find that they are equal.
    I have a feeling there's something about the serialization process that I don't fully comprehend. Is there a way to properly implement object comparison using serialization?
    Thanks in advance!

    When you serialize an object, you also serialize the entire tree of references based on that object (except for transient variables). That tree is the complicated business you described there. Serialization stores all the objects in the tree, along with data that explains which objects refer to which other objects. Furthermore if the tree is actually a graph, and there are multiple ways to get to an object, it still only stores each object once. I don't see any reason to believe that all that relationship data would be encoded identically for a pair of trees that you deemed to be equal. And your experiment shows that indeed it isn't.

  • Using an array list as a hash map value

    Hi,
    I have an object which has a "properties" field, which contains certain data for that object.
    Most of the time the key/values are both Strings, but in at least one instance, the key is a string, the value needs to be an array list.
    The Map is declared as HashMap<String, Object>
    when I populate the map, and then attempt to retrieve its value, it seems to work correctly.
    But when I try to retrieve the arrayList from another object, using its getter, it doesn't work,
    IOW, if I have code like this:
    // object created from outside the class where the map is populated
    ExampleObject eo = new exampleObject();
    eo.getProperties.get("string value that is a key for the map. ");
    // if I try to determine the class the value is,
    System.out.println("class: " + eo.getProperties,get("string value that is a key for the map. ").getClass());
    // the code above indicates the object is a string. I googled and found a suggestion on this forum, that instead of making the map value an arrayList, I should create an object that contains an array list as a field, and then use that new object as the map value. I tried that and had the same problem.
    any idea what I'm doing wrong? Hope that's clear...
    thanks!!
    bp
    Edited by: badperson on Aug 13, 2008 9:38 AM

    threw this together and it worked fine, so something else is screwed up in my code.
    import java.util.*;
    public class MapTester {
         private HashMap<String, Object> testMap;
         private ArrayList testList;
         public ArrayList<String> createList(String listName){
              System.out.println("creating list");
              testList = new ArrayList<String>();
              testList.add(listName + " line one");
              testList.add(listName + " line two");
              testList.add(listName + " line three");
              return testList;
         public HashMap<String, Object> createMap(String key, Object value){
              System.out.println("populating map");
              testMap = new HashMap<String, Object>();
              testMap.put(key, value);
              return testMap;
         public static void main(String[] args){
              MapTester mapTester = new MapTester();
              mapTester.createList("List 1");
              mapTester.createMap("listKey", mapTester.getTestList());
              System.out.println("retrieving arrayList");
              System.out.println("map value is type: " + mapTester.getTestMap().get("listKey").getClass());
         public ArrayList getTestList() {
              return testList;
         public HashMap<String, Object> getTestMap() {
              return testMap;
    }thanks for the replies
    bp

  • Where-Object Question

    I'm trying to filter out some data in a csv flie I'm reading to generate another file but I can't seem to get my where to work.
    In a nut shell, I want to select all users that are missing some pieces of data (an email address and a manger) but for some user types (students and residents) I want to filter them out (even though they are missing a manager, if they have an
    e-mail address I want it filtered out)
    This is what I tried but it didn't work and they more I look at it the more I think I have the logic wrong but I'm just stumped. I've spent a few hours on it now.
    Import-CSV -Path $inputFile | where { ($_.email -lt "*" -or $_.manager -lt "*" ) -and ($_.usertype -notlike "*student*" -or $_.usertype -notlike "*resident*") -and $_.email -gt "*" ) } | select $userAttributes | export-csv $outputPath
    I also tried doing like a sub-query importing the users I want filtered out into an array and then doing a -notcontains but that didn't work either.
    $filterOut = Import-Csv -Path $inputFile | where { ($_.userType -like "*Student*" -or $_.userType -like "*Resident*") -and $_.email -gt "*" } | select person_id
    Import-CSV -Path $inputFile | where { ($_.email -lt "*" -or $_.manager -lt "*" ) -and $filterOut -notcontains $_.person_id } | select $userAttributes | export-csv $outputPath
    Any ideas? Thanks for the help.

    Thanks all for the suggestions. To clarify:
    I have two queries that use the same input file (they generate two different reports that are saved to csv files).
    1. Pulls a list of users where values in certain fields are not null, for this query I'm using -gt "*" and that seems to work - but it sounds like I can just use $_.value from what you described above to factor out the nulls?
    2. (This is the one I'm having problems with) I want to return a list of users that are missing a
    manager and an email address (this is where I was using -lt "*" to say if this is null, select it. It was the only way with my knowledge I could get this to work) but there is an exception to this condition. If the user is a
    student or resident and they are missing a manager value
    but have an email
    then exclude them from the report. However, if the student/resident
    is missing both the manager and email values then they need to be included in the report.
    Does this additional context help?
    Thanks all for your help.

  • How can I use my array in another method.... Or better yet, what's wrong?

    I guess I'll show you what I am trying to do rather and then explain it
    public class arraycalc
    int[] dog;
    public void arraycalc()
    dog = new int[2];
    public void setSize(int size)
    dog[1] = size;
    public int getSize()
    return dog[1];
    This gives me a null pointer exception...
    How can I use my array from other methods?

    You have to make the array static. :)
    Although I must admit, this is rather bad usage. What you want to do is use an object constructor to make this class an object type, and then create the array in your main class using this type, and then call the methods from this class to modify your array. Creating the array inside the other method leads to a whole bunch of other stuff that's ... well, bad. :)
    Another thing: Because you're creating your array inside this class and you want to call your array from another class, you need to make the array static; to make it static, you must make your methods static. And according to my most ingenious computer science teacher, STATIC METHODS SUCK. :D
    So, if you want to stick with your layout, it would look like:
    public class arraycalc
         static int[] dog;
         public static void arraycalc()
              dog = new int[2];
         public static void setSize(int size)
              dog[1] = size;
         public static int getSize()
              return dog[1];
    }But I must warn you, that is absolutely horrible code, and you shouldn't use it. In fact, I don't even know why I posted it.
    You should definitely read up on OOP, as this problem would be better solved by creating a new object type.

Maybe you are looking for