Extract Data from multiple files and POPULATE the masterfile - extract

I'm Akshey and I am new to VBA. I have just started learning the basics. Would really appreciate if you could help me with this situation.
In our organisation we have to fill an " Availability Tracker " specifying the hours we are free to work ( incase of no schedule work ) and incase we have work our senior/ supervisor, the work and the hours.
Till now we had a single shared sheet for 120 employees. What I am thinking of doing is that there should be 120 sheets ( one for each employee ). These files will be saved to one folder. There will be macro enabled Master File which will extract all the data
Here is the example of individual Sheet ( the way I want it to be ) :
A B C D E F G
1
2 Snr.>/ Staff| Snr. 1 Snr. 2 Snr. 2
3 Client Hrs Client Hrs Client Hrs
4 Staff 1 XYZ 2 LMP 3 - -
Every employee will fill B4:G4 everyday.
Here is the example of the master file :
Note : All the files will be having the same format. The master file will have the same format. And data has to pulled from the individual sheets and populated to Masterfile
A B C D E F G
1
2 Snr.>/ Staff| Snr. 1 Snr. 2 Snr. 2
3 Client Hrs Client Hrs Client Hrs
4 Staff 1 XYZ 2 LMP 3 - -
4 Staff 2 ABC 1 LMP 3 - -
4 Staff 3 APP 5 LMP 3 - -
4 Staff 4 .. 12 XYZ 2 LMP 3 - -
.....
Basically what I want is that masterfile to be updated with data in B4:G4 of every individual sheets.
Any help would be appreciated !

Related

Trying to write a script to insert a line separating like data

I am trying to write a script to insert a line that will separate data based on specific information.
This is what the spreadsheet looks like:
Date of the Game Name Section
02/25/2023 bob 1
02/25/2023 billy 2
03/04/2023 - CL beth 3
03/04/2023 - CL martha 4
I would like to script to change the spreadsheet to add a blank row between date groups:
Date of the Game Name Section
02/25/2023 bob 1
02/25/2023 billy 2
03/04/2023 - CL beth 3
03/04/2023 - CL martha 4

MySQL - Get result for root node for a table containing end node items

I have a table which lists all the employees in an org with their immediate parent.
id
name
parent
type
1
A
0
1
2
B
0
1
3
C
1
2
4
D
2
2
5
E
3
3
6
F
4
3
7
E
5
4
8
F
6
4
I have another table which lists actions by last node employees:
id
action
type
emp_id
1
Action Name
0
7
2
Action Name
0
8
3
Action Name
1
7
4
Action Name
2
7
5
Action Name
3
8
6
Action Name
4
8
7
Action Name
5
7
8
Action Name
6
8
I need to show a hierarchical view of the action count. As evident above, all the actions are created by either employee with an id of 7 or 8. I need to show the number of actions by employees with type 1 based on their own actions or by any sub down the chain.
At the moment, I pull the counts on the end node using sql and then use the scripting language to build the hierarchy bottom up.
Is there a better way to achive this with SQL?

tree privileges database design

I'm unsure into how to ask this so i will try to illustrate with an example.
What i am trying to achieve is an application that will be able to discern different levels of privileges. and i can't figure out how my database and queries should be made.
there are this levels of user:
Director
Manager
Executive
So a column in my user table will be a privilege INT to know what type of user, and another column will be Parent user, since x amount of Executives will be assigned to a manager, and x amount of managers will be assigned to a Director.
Example table USERS:
ID username privilege parent
1 Director1 1 null
2 Director2 1 null
3 Manager1 2 1
4 Manager2 2 1
5 Manager3 2 2
6 Executive1 3 3
7 Executive2 3 3
8 Executive3 3 4
9 Executive4 3 4
10 Executive5 3 5
11 Executive6 3 5
And they will have their "costumers".
Example table COSTUMERS
ID name seller
1 c1 11
2 c2 10
3 c3 10
4 c4 9
5 c5 8
6 c6 7
7 c7 6
8 c8 5
9 c9 4
10 c10 3
11 c11 2
12 c12 1
so if an Executive went into the app it would only be able to see their own costumers.
but if a manager went in he would be able to see his costumers and also from the executives assigned to him. and the same happens to the directors.
Is this the right way to make it? if so what would be the best approach to an effective query?
example diagram( you can see the organization diagram and each of the costmer every user has.
for example if users was to check his costumers he should see:
Director1: C12,C10,C9,C7,C6,C5,C4
Director2: C11,C8,C3,C2,C1
Manager1: C10,C7,C6
Manager2: C9,C5,C4
Manager3: C8,C3,C2,C1
and the executives only would see their own costumers.

How to create a query based on condition with 3 joined tables in MySQL

I'm a bit confused when trying to create a specific query with the following data tables:
**table 1 - referral_data:**
ID attribution_name
------------------------
1 Category
2 Brand
3 Size
4 Color
5 Processor
6 OS
7 Screen Size
.....
**table 2 - referral_values:**
ID ref_data_id attribution_value
---------------------------------------------
1 1 Cell Phones
2 1 Tablets
3 1 Laptops
4 1 Computers
5 1 LCD Monitors
6 2 Nokia
7 2 Motorola
8 2 Samsung
9 2 Lenovo
10 2 Philips
11 3 10x10x11
12 3 100x100x20
13 3 10x200x200
14 3 2x2x3
15 4 Black
16 4 Cyan
17 4 Magenta
18 4 White
19 4 Blue
20 5 ARM Cortex A11
21 5 Snapdragon 11
22 5 Intel I3 XXXXX
23 5 Exynos XXXX
24 6 Android 4.1
25 6 Android 3.0
26 6 Windows Phone 3
27 6 Windows 8 Professional
28 7 18.5"
29 7 11.8"
30 7 7.0"
31 7 5.0"
32 7 3.5"
......
**table 3 - product_specs:**
ID product_id referral_data_id referral_value_id
--------------------------------------------------------
1 1050 1 1 // <-- Product 1 - Category: Cell Phones
1 1050 2 8 // <-- Product 1 - Brand: Samsung
1 1050 4 19 // <-- Product 1 - Color: Blue
1 1050 6 24 // <-- Product 1 - Processor: Exynos XXXX
1 1050 7 30 // <-- Product 1 - Screen Size: 7.0"
1 1068 1 4 // <-- Product 2 - Category: Computers
1 1068 2 9 // <-- Product 2 - Brand: Samsung
1 1068 6 22 // <-- Product 2 - Processor: Intel Core I3
1 1068 7 28 // <-- Product 2 - Screen Size: 18.5"
......
These tables consists in a "Product Catalog" that I'm planning to use in a e-commerce website.
This is intended to optimize "client side" search functions and organize internal product data information, turning the "content-administrators" tasks in a simplest and easiest environment as possible. (Letting them, for example, choosing an "already-entered" data values instead of re-entering an "already entered data", avoiding duplicated data or typo errors).
The "content administrators" will have options, according to that "table dynamics", to insert new attribution data (product characteristics) and or new attribution values to them (attribution values).
Info: the product code field named "product_id", is outside the tables relation, this is just used to create a link to attach informations to products that they belong to.
In general SQL Joins to get data over the tables, I'm Ok. But there some kind of informations that I need to get / manage, I'm getting nuts. I've spent A LOT of hours and I just have found a headache.
My question is about how to build, in a single query, to get commonly used referral data, based on a CATEGORY.
(when the contents admin choose, for a example, "Cell Phones" in "Category" field, they will get a commonly used "data table information" about that Category, like Brand, Color, Screen Size, etc .... to just choose their category attribution ) and to create a similar query to highlight or order by the commonly used attribution values ( i.e. commonly used screen sizes ).
In a single query?
SELECT ps2.product_id,rv2.attribution_value,rd.attribution_name
FROM ((
(select ps.* from product_specs ps JOIN referral_values rv
ON rv.ref_data_id=ps.referral_value_id
WHERE rv.attribution_value = 'Cell Phones'
) ps1
JOIN product_specs ps2 on ps1.product_id=ps2.product_id)
JOIN referral_values rv2 ON ps2.referral_value_id = rv2.id)
JOIN referral_data rd ON rd.id = rv2.ref_data_id;
The inner select is used to get the right product_id based on criteria 'Cell Phones'. The others are used to populate this value with all details. To do this the first JOIN is a self-JOIN of product_specs to get all data, the following two joins are used to get the string values of them.
By the way: The column product_specs.referral_data_id is redundant and can/should be removed

Group data on X-axis

I have a SharePoint list with 5 options (questions). Each option has a dropdown with values 1-6. The user (employee of a company) needs to select an option, then select a value from the dropdown and hit Submit. The selected value is unique. In other words, if the user selects the value 1 for the first option, that value cannot be chosen again. Here's an example form -
Category Rank
------------------------------
1. Work/Life Balance 4
2. Compensation 2
3. Commute 3
4. Work 1
5. Development 5
After filling the form, the data looks likes this on the Sharepoint list -
Employee Manager Work/Life Compensation Commute Work Development
--------------------------------------------------------------------------------
1. Employee 1 Manager 1 2 4 3 1 5
2. Employee 2 Manager 3 1 3 4 5 2
3. Employee 3 Manager 1 5 4 2 3 1
4. Employee 4 Manager 2 4 1 5 2 3
I'm able to get the Y-axis (for Rank) on the report just fine. The X-axis needs to display each category grouped by each Manager. Here's a sample of how I want it to look like -
Each colored bar on the X-axis is a Manager. This is my first time with SSRS (2012) and I'm just not sure how to accomplish this. If this is not possible, will moving the data to a SQL table in a different layout help? Any help is greatly appreciated.
You could aggregate each employee's response into an average in your dataset (I'm assuming you know how to do this):
Averages (just pretend)
Manager Work/Life Compensation Commute Work Development
--------------------------------------------------------------------------------
1. Manager1 2 4 3 1 5
2. Manager3 1 3 4 5 2
3. Manager2 4 1 5 2 3
Then you can use the categories as you have, with the manager as the series field. Pretty sure that should achieve what you're looking for.