In the Output , i am able to see only first record of each group , I am not able to retrieve next lines from each group
Although my nested loop is iterating as per count of each group ,instead of reading next lines,same first line is repeated in each group,please suggest, how we can read next lines in each group
I already asked this in your other thread. This way it’s a lot of work to use your source data. So please format sample data as code as well.
And I already asked this in the other thread as well. What’s the desired output? You group the source data and then you un-group it again. That does not make that much sense. We might be able to recommend or help if you’d answer.
Existing code:
Currently i am calling Invoke-RestMethodwith POST or PATCH for every record from csv , and sending an email to user after processing each record. The problem with that approach is , if the csv has two records with same organisation ,project and username but different values for database,role names , i am sending two emails.
Proposed Change :
if the username,organisation name and project name is same for couple of records , Send a consolidated email to user after doing post/patch instead of sending multiple emails to same user.
To implement that :
First i used Group-Object on username,projectname,organisation name .
Next i am trying to iterate in each group , and for each record in a group , am trying to call POST/PATCH method
After processing all the records in a group , i am planning to send consolidated email with the list
of Database names and Role names
Issue Faced :
After creating groups from input csv file , I am only able to read first line from a group, and not able to read next lines with in a group
Please correct me if there is any simpler approach of if my existing code needs any changes to read all the records in a group.