I am trying to streamline our password reset script at work.
We have been asked to send password resets to team leads.
I am looking to get the script pull the team lead name from a CSV file.
We have an export for the team memberships (this can change across the company so we would export to a CSV once a week or so)
The problem is the format of the CSV file.
I am thinking of using the Out-Gridview with selection feature, but I dont want to display the whole CSV, just the team the member is part of.
I am looking for a way to search for Department (sales, service desk, HR, etc..), then Team, and finaly dislay just the team members email addresses, and another column indicating role if available (not all have that listed).
I have no issues with importing, dislaying in grid view, or returning the selected member info to the script - it is just narrowing what is displayed.
An example is (sorry about the text layout - didn't see a table option):
_______________________________________________________
Department |User ID |Email
_______________________________________________________
Service Desk | |
_______________________________________________________
Team 1 | |
_______________________________________________________
|Member 1 |Member 1 email
_______________________________________________________
|Member 2 |Member 2 email
_______________________________________________________
| |
_______________________________________________________
Team 2 | |
_______________________________________________________
|Member 4 |Member 4 email
_______________________________________________________
|Member 5 |Member 5 email
_______________________________________________________
The code to select a person looks like this at the moment, but you still have to search the whole index. Oh and it looks like I forgot this at the start - I am using powershell 3.0
$userList = Import-Csv 'E:\users.csv'
$TeamLead = $userlist | Out-GridView -OutputMode Single
$Teamleademail = $teamlead.email
Basically I am looking for a way to select the group of rows following the department (say everything from Service desk to HR), and then further narrow it by teams (selecting all the rows between team 1 and 2), and then displaying just that section in the grid view.
I know the filtering would be somewhere between '$TeamLead = $userlist' and 'Out-GridView -OutputMode Single', but I cant think of a way to select the rows with empty department column information.
Thanks for any assistance with this.
Related
In Azure DevOps, is there a way to get a view that looks something like this, showing all work items scheduled for them in sprints?
Example:
Developer | Sprint 1 | Sprint 2 | Sprint 3
John | US123 | US124, US125 | None
Steve | None | None | US126
Adam | US127 | US128 | None
So far in Azure DevOps, the closest view that I have found is the Feature Timeline plugin from Microsoft here: https://marketplace.visualstudio.com/items?itemName=ms-devlabs.workitem-feature-timeline-extension&ssr=false#overview
There is no directory to get the report as above example. You can create a query to export workitems to a .csv file. And then do the necessary operations (group, filter,etc.) in the csv file. Please refer to below steps.
1, Create a query. Boards-->Queries-->New Query
Edit your query filters to query all the User Story work item, Then click Column options to select what fields to display in the query results.
Then click the 3dot(...) and select Export to csv
When you get the .csv file, you can modify the file. For example create a simple pivotTable like below screenshot.
Another possible way is to use PowerBI to generate a report from the workitems.
You can check the sample PowerBI reports here. Check the PowerBI sample query here.
I have Products and Company tables that look something like this:
Company:
id | name
----------
1 | Google
Products
id | companyId | name
---------------------
1 | 1 | Google Home
2 | 1 | Pixel
Tags
id | name
----------
1 | Consumer Electronics
2 | Computer
3 | Cell Phone
Now I am not sure if I should do a junction table between company -> tags and products -> tags or if there is a way to have one for both or what. When I am searching for companies I want to be able to use the tags for the company and all children products, ie if I search for a Computer and Cell Phone it should find Google. Then if I am searching for Products by Consumer Electronics and Computer, it should return Google Home.
Any help would be greatly appreciated.
I'm going to attempt to word this question without being too confusing.
We have a report we want to show each patient and their insurance. Each of the insurance in the patient's record is number by an Order Number. However, we don't only want to show that; I want to put in certain criteria so that if Insurance A has order number 1 under the Patient ID, show all of this patient's insurance. If the patient does not have Insurance A in Order Number 1, do not show this patient nor any of their information on the report.
In the code below, guarantor is referring to insurance. So order number and guarantor name is what we're focusing on. Here's the code I've put into Section Expert for the Suppress option. What I assume is if it meets the criteria, TRUE will suppress the information, else FALSE will allow the information. However, this is not sufficient as it suppresses all of the other information.
if {billing_guar_order_no_ep.guarantor_order_number} = "1" AND
{billing_guar_order_no_ep.guarantor_name} = "Medicare" then
false
else
true
What I'm assuming is it will need to iterate or loop through every patient and if it finds this information, list ALL of the patient's information and move forward, else suppress and move forward. I hope this makes sense.
Example:
|Patient ID|Order Number|Guarantor Name|
| -------- | ---------- | ------------ |
|1 | 1|Medicare |
|1 | 2|Medicaid |
|2 | 1|Medicaid |
|2 | 2|Medicare |
In the above example, what I want is for the report to show everything from Patient #1 (including all order numbers) and to not even show Patient #2 in the report. However, what's happening is Patient #1 does show up, but only Order Number 1; it suppresses all the other information.
What am I missing?
The query that you want will be an adaptation of this:
select *
from data d
where not exists (
select 1
from data
where pat_id=d.pat_id
and order_id=1
and guarantor_name='Medicaid'
)
The 'Linking Expert' doesn't support this syntax, so you'll need to use a Command instead.
Process:
get the current query by selecting Database | Show SQL Query ...
create a new report
select 'add command' from within the database expert
paste the query, then adapt it
I have a table format that appears in this type of format:
email | interest | major | employed |inserttime
jake#example.com | soccer | | true | 12:00
jake#example.com | | CS | true | 12:01
Essentially, this is a survey application and users sometimes hit the back button to add new fields. I later changed the INSERT logic to UPSERT so it just updated the row where email=currentUsersEmail , however for the data inserted prior to this code change there are many duplicate entries for single users. i have tried some group by's with no luck, as it continually says the
ID column must appear in the GROUP BY clause or be used in an
aggregate function.
Certainly there will be edge cases where there may be clashing data, in this case maybe user entered true for the employed column and then in the second he/she could have enter false. For now I am not going to take this into account yet.
I simply want to merge or flatten these values into a single row, in this case it would look like:
email | interest | major | employed |inserttime
jake#example.com | soccer | CS | true | 12:01
I am guessing I would take the most recent inserttime. I have been writing the web application in scala/play, but for this task i think probably using a language like python might be easier if i cannot do it directly through psql.
You can GROUP BY and flatten using MAX():
SELECT email, MAX(interest) AS interest,
MAX(major) AS major,MAX(employed) AS employed,
MAX(inserttime) AS inserttime
FROM your_table
GROUP BY email
I have a crystal report, it has a group by statement based on two fields
Companyname
Account Type
Now Crystal report work and it does group by "companyname" but it does not group by "account type". I have two types of account, "Regular and Premium". One company has both type of account with us and it pulls on regular and not premium. What do you think is the issue.
I am new to crystal report. I am familiar with SQL Though. The differences that I see is
There is no aggregate function used for any column - in SQL an aggregate field is required to get meaningful result
There are about 10 fields in the report but group by is used only on two fields - in SQL you have to group by all fields if there are more than two fields
The group by fields are in the middle and in end - again in SQL the order of groupby field is important
In this case I am grouping by companyname first and then account status. Any insight will be helpful.
Note that I generated the equivalent SQL statement from Crystal Report. That query was ok except there were not group by statements. I added those and the aggregate column myself and I do get the same result as I am getting in Crystal (but the SQL report is more accurate as it does group by both the fields not just one).
Edit: Example Date. Each company can have multiple account of the same type. I want aggregate on "Company Name" and "AccountType" so that the data is listed as follow.
+----+--------------+-------------+------+
| ID | Company Name | AccountType | Sale |
+----+--------------+-------------+------+
| 1 | ABC | I | 500 |
| 2 | ABC | I | 600 |
| 3 | ABC | O | 1000 |
| 4 | ABC | O | 2000 |
| 5 | ABC | O | 3000 |
| 6 | XYZ | O | 2500 |
| 7 | LMN | O | 3400 |
+----+--------------+-------------+------+
Output I want from the above table is
+--------------+-------------+------+
| Company Name | AccountType | Sale |
+--------------+-------------+------+
| ABC | I | 1100 |
| ABC | O | 6000 |
| XYZ | O | 2500 |
| LMN | O | 3400 |
+--------------+-------------+------+
Update to incorporate comment discussion and revised question:
There are two basic options for resolving this issue:
1) Revise the SQL to perform the desired aggregation.
2) Within Crystal, add two groups, one for the company, then one for the account type.
Before you add groups in crystal, you have several standard sections, including the Report Header, Page Header, Details, Report Footer, and Page Footer.
If you do not perform grouping, each row that is read in the database will be displayed in the details section (technically, the entire details section is repeated for each row).
When you add the first group (Company), Crystal adds a Group Header #1 before the Details section and a Group Header #1 after the Details section.
If you run the report at this point, for each company Crystal will show the Group Header before each group of detail records associated with that company, then will show all of the detail records for that company, and finally, will shown the Group footer for that company.
Typically, the group header is used to display common information for that grouping that does not need to be repeated for each detail record. In this example, we could display the company name and other information related to the company.
Likewise, the group footer is typically used to display summary information for all of detail records displayed within that group.
In this case, we could add an aggregate that would summarize the Sale amount, which would be the total sales for that company, regardless of the account type.
When the second group is added, it will perform sub-grouping on the original group.
When the second group is added, Crystal will place a Group Header #2 below Group Header #1 and above the Details and will place a Group Footer # 2 directly below the details and above the Group Footer #1.
At this point, you have a report format similar to the following:
Group Header #1 (Company)
Group Header #2 (Account Type)
Details (the individual sale records)
Group Footer #2
Group Header #1
In this case, for each company, we want to group the details records by account type. So we can add information that describes the account type, if we want, to the Group Header #2 and we can add aggregates to Group Footer #2 to display totals for each account type within the company.
Now, if all that is desired is to show the totals for each account type within each company, then the only section that we need to show in the report is Group Footer #2. All of the fields (company, account type, sale aggregate) are available in this Footer, so we don't need any of the additional areas.