Advanced Form creation - needed advice or suggestion - forms

I have a dataset in MsAccess:
Fact Table - ChartReview:
ID EmployeeFK CategoryFK ObjectiveFK YesNoFK
1 22 1 1 0
2 11 1 2 1
3 11 2 3 1
4 22 3 6 2
5 22 2 5 0
6 22 2 4 1
Dimension Tables -
3_Employee:
ID EmployeeName
11 James Smith
22 John Doe
4_YesNo:
ID DescriptionYesNo
0 N/A
1 Yes
2 No
1_Category:
ID DescriptionCategory
1 Orientation
2 Individual
3 Progress
2_Objective:
ID CategoryFK DescriptionObjective
1 1 Object1
2 1 Object2
3 2 Object345
4 2 Object556
5 2 Object666
6 3 ObjectLast
Here is the Relations Model (colored dots show the appropriate relation):
My goal is to create a Form or (Form + SubForm)- where user will add data as following -
User will select the EmployeeName, and then - will proceed with the Category selection.
Then - will enter the Objective values (Yes, No or N/A) according to each Category associated with its Objective.
I created the Main Form (data source - ChartReview table):
and the Sub Form (data source - dimensions - Category, Objective tables):
But - my problem - I don't know how to connect MainForm + SubForm...
(so the user would enter data into Main, and then would be transferred to a Sub and will enter Yes/No/N/A for each Objective)
Also, I need my Yes/No/N/A values would be bound to each Objective, while now, unfortunately they're bound to only the 1st Objective...
And the last, I am not even sure the user will actually be able to fill out my SubForm, as it's created out of the Dimensions.
When I tried to enter or to change the info in the SubForm - the following error appears:
Any advice or suggestions - welcome !!!

Open the form in design view.
Click on the subform to select it.
If you can't see the properties pane, Right click on the subform and choose properties.
On the data tab there are the fields that you need to fill in.
Link Master Fields and Link Child Fields.
To start, put 3_Employee.ID in the "link Master fields" box
and ChartReview.EmployeeFK in the "Link Child Fields" box.
Manually enter valid data to test that the employee record works, then add the other links once this works.

Related

Grouping multiple values

Grouping multiple values on Details section
I have got an output from SQL query:
ID Value
1 1
1 3
1 5
1 7
1 9
2 1
2 4
3 1
3 2
3 3
I just want to have on each page ID and whole list of values assigned to this id. On next page I should have next ID a it's values.
As you can see for ID 1 I have got 4 values, for 2 I have got only 2 values, for 3 I have got 3 values. I want to say that how many values I have got for particular ID can be different.
I don't know what is the name of this kind go grouping, If someone will name it I will be able to dig the Internet to find the solution.
If someone knew how to do this and will share the knowledge I will really appreciate this.
Best regards,
Volcano
You should add a group (Insert Group) for ID and put Value in the detail section. Make sure to start each group on a new page (Section Expert for your group header or footer, then tick New Page Before / After.

Postgres funnel analysis (time spent)

I have a table like this:
id visited_time page visitor_id
1 2019-04-29T10:44:53.847014+02:00 1 1
2 2019-04-29T10:46:53.174894+02:00 1 3
3 2019-04-29T10:49:44.000390+02:00 2 1
18 2019-04-29T10:52:46.574140+02:00 2 3
19 2019-04-29T10:52:58.158146+02:00 3 1
20 2019-04-29T10:53:27.402038+02:00 1 9
25 2019-04-29T10:55:18.275441+02:00 2 9
54 2019-04-29T11:10:01.818343+02:00 1 13
72 2019-04-29T11:40:28.056813+02:00 2 13
A visitor will also be going from page 1 to 2 to 3 and so forth (but can dropout along the way). I want to find the average time spent on each page. Logically this is the difference between the a unique visitor_id visited page 1 and then page 2 etc.
Is there a smart way to do this in postgres?
Here you go:
SELECT
page,
avg(visited_time_next - visited_time)
FROM
(
SELECT
page,
visited_time,
-- the time of the next page view by a certain visitor...
lead(visited_time) OVER (PARTITION BY visitor_id ORDER BY visited_time) AS visited_time_next
FROM visits_so_56097366
) AS tmp
GROUP BY page
ORDER BY page;
Online example: https://dbfiddle.uk/?rdbms=postgres_11&fiddle=e64dd8862350b9357d9a4384937868c9
Please also make sure that you have an index over visitor_id and visited_time, otherwise you'll end up with very expensive sorts for larger number of intermediate rows:

SPSS - Create dummy for top volume months within customer grouping

I need to create a dummy for the top purchase months within each customer ID. That is, if a month belong to one of the four months within the year where the customer purchased the most then it is noted with the number 1, otherwise 0.
Example of data, cust id, order date, volume and new variable dummy:
This code creates some sample data:
data list free/ID volume (2f4).
begin data
1 100 1 500 2 1 2 2 2 3 2 90 1 600 1 90 1 870 2 9 2 8 2 10
end data.
Using the sample data in the question, this code will create a new variable containing the dummy according to your definition:
RANK VARIABLES=volume (A) BY ID /RANK.
compute high4=(Rvolume<=4).

Add values from multiple columns in pivot table

I have a created a pivot table from an Excel spreadsheet which has many columns and many rows. Here is my requirement.
The Pivot Table has
Row Labels --> Individual Names
Column Labels --> Types of Products
Now I have 4 regions like AP, EMEA, CALA, & US in the Excel spreadsheet.
I need to get the value of = Sum of (AP + EMEA + CALA + AP), for each type of Product for the respective individual name.
For example,
Clarke would have sold Type 1 Product, 4 Nos in AP, 10 in EMEA, 4 in CALA, 7 in US
would have sold Type 2 product, 12 Nos in AP, 16 in EMEA, 8 in CALA, 5 in US
I need pivot table, which looks like
Type 1 Type 2 Type 3 Type 4
Clarke 25 41 0 0
Marsh 11 20 12 6
How do I get this?
Like this:
Grand Total for rows and columns is optional and other Types/Names etc may be added to suit into the source data without other configuration changes except (i) possibly the range will need extending (PivotTable Tools > Data - Change Data Source) and (ii) the PT will need to be refreshed (right-click on the data area and left-click Refresh).

How to show categories and sub categories in view page and select menu in zend frame work

i'm having the table like
category_id category_name parent_id
1 General Grocery 0
2 Ready to eat 0
3 rice 1
4 oils 1
5 flour 1
6 seed 1
7 testing cate 0
8 testing 5
i want to display the categories with "n" number of sub categories in subcategories. My main moto is by using the array generated by the code i want to display in view page and the select menu in the zend form. I found the code in php. but i'm unable to use that in zend. Can some one help me out with this please.
Thank you.
I think you need to generate a tree.. so there are two known patterens to me
adjacency level pattern
Nested Level Patteren
I suggest you to use Nexted level pattern
If you follow the given below two links you will surely come to know what to do.
http://blog.richardknop.com/2009/05/nested-set-model/
http://baobab.sideralis.org/
By this you can generate appropriate tree. now you have to generate a tree in which you can select your items. so you should use this tree http://www.dhtmlx.com/docs/products/dhtmlxTree/index.shtml
you can keep checkboxes to select the items and store in the database