join  Variable A item “User” with Variable B “email”

Welcome Forums General PowerShell Q&A join  Variable A item “User” with Variable B “email”

Viewing 4 reply threads
  • Author
    Posts
    • #285538
      Participant
      Topics: 2
      Replies: 8
      Points: 42
      Rank: Member

      Hi,

      Asking for help on a simple issue.

      I have two variables and I would like to combine data from each and then output the results into a CSV.

      Can some one please point me in the right direction on how best to do this.

      For example,

      Variable A, has the following items “User”, “Delegate”, “Status”

      Variable B, has the items “group”, “type”, “role”…”email”

      I would like to join  Variable A item “User”  with Variable B “email”

      If there is a match I would like to create a new variable which combines these items “User”, “Delegate”, “Status” and “group”, “role”…”email”

      I’m just scratching my head on the best way of doing this, and advice is welcome.

      Thanks

    • #285619
      Senior Moderator
      Topics: 9
      Replies: 1449
      Points: 5,428
      Helping Hand
      Rank: Community MVP

      To combine, you should have some element in common to ensure the right combination. It should be mostly user or email. Do you have anything common between A and B ?

    • #285661
      Participant
      Topics: 2
      Replies: 8
      Points: 42
      Rank: Member

      Thanks for getting back, yes the email address is the same in both Variable A and Variable B.

      for example – Variable A (User: [email protected])  = Variable B (email : [email protected])

      Here is an out put from Variable A :

      User Delegate

      — ———

      User: [email protected] Show 0 Delegates
      User: [email protected] Show 1 Delegate
      Delegate: [email protected]
      Status: accepted

      User: [email protected] Show 2 Delegates
      Delegate: [email protected] (1/2)
      Status: accepted

      Delegate: [email protected] (2/2)
      Status: accepted

      User: [email protected] Show 0 Delegates

      Here is an out put from Variable B :

      group : [email protected]
      type : USER
      role : OWNER
      status : ACTIVE
      email : [email protected]

      group : [email protected]
      type : USER
      role : MANAGER
      status : ACTIVE
      email : [email protected]

      group : [email protected]
      type : USER
      role : MANAGER
      status : ACTIVE
      email : [email protected]

      group : [email protected]
      type : USER
      role : OWNER
      status : ACTIVE
      email : [email protected]

    • #285664
      Participant
      Topics: 9
      Replies: 706
      Points: 2,837
      Helping Hand
      Rank: Community Hero

      Note even after changing the temp.com to test.com in Variable B data, only two entries from Variable A match entries from Variable B.

    • #285787
      Participant
      Topics: 2
      Replies: 8
      Points: 42
      Rank: Member

      Many thanks for this, I think im on the right track.

      Is it possible to contact you directly to get further help on this…? If it’s not possible – not to worry.

      Regards

       

       

Viewing 4 reply threads
  • You must be logged in to reply to this topic.