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

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

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.

Two different detail sections side-by-side with two different tables?

I use two different excel files in one report. The columns of the excel files are stored in fields. I want to show the columns side-by-side:
Excel Data 1:
ID Name
1 Blub
2 Blub2
Excel Data 2:
ID Income
10 10134
20 134343
So the result should look like this:
ID Name ID Income
1 Blub 10 10134
2 Blub2 20 134343
I tried it with two different Detail sections (I have to use detail sections) and activate the overlaying of underneath sections for both detail sections.
The result looks like:
ID Name ID Income
1 Blub
2 Blub2
10 ....
20 ....
That is because we use a function model of BW that will give us the data back like this:
ExcelFile ID Name Income
1 1 Blub
1 2 Blub2
2 10 10134
2 20 134343
I can not use sub reports and cannot use single fields for each value because there are 100 cells in there...
Does anyone knows a solution?
You have to split your detail row vertically to do that. Something similar already solved by me here. Be careful when you width of data size.
If it doesn't help you enough, feel free to ask with additional questions.
I tried it:
Data looked like this:
After that it looked like this:
I did a Grouping on the names "GS_FC...." so there are two groups in the report. Than I put the Field which contains the name of the Excel File (GS..._TFCF and GS...._NFD) in the Detail section with this settings:
Is this the right thing to do?

Crystal Reports - Checking for a row in a table based on criteria from two different columns

I have a table of jobs, with columns showing which engineer the job is assigned to and the area of the country, which can be simplified like this:
JobNumber Area Engineer
1 A 3
2 D 1
3 E 2
4 B 2
5 A 1
I have a table of engineers, and a table of areas of the country.
I have a final table which shows the areas of the country each engineer is assigned to, like this:
Area Engineer
A 1
A 2
A 3
B 2
B 3
What I need to do in Crystal Reports, is create a formula field (or similar) to show whether or not the engineer was in one of his assigned areas.
I think the reason my efforts thus far have failed is that the join is effectively circular. I have played around with SQL Commands and join options to no avail.
Can anybody offer advice on how I can solve this problem?

Is this an approach to user-item recommendations that could work

I am designing an application that incorporates a recommendation system base on user interactions (collaborative filtering). The user on his homepage is presented a set of 6 items to interact with. There will be between 50 and 300 items. The following actions are possible:
click on an item (strong interest)
refresh an item (some interest)
open a read-more dialog (some interest)
don't do anything an move on (no interest)
This data is collected and stored. The system should recommend items of interest to the user. I'am thinking about turning this data into a rating system.
Option A) if the user clicks on an item, this is translated into a implicit lifetime rating of 5. refreshing an item it a 4 and so on. So my user->item matrix would look like this:
item 1 | item 2 | item 3
john 5 4
jane 4
In this example john has clicked on item 1 and refreshed item 3. The rating can only go up really, i.e. if a user has previously refreshed an item I write a 4 and update only to a 5 if the item is clicked later.
Option B) each time the user does one of the above actions, I'll increment a scalar value for the item, which means it can grow unbounded.
item 1 | item 2 | item 3
john 55 1 30
jane 41 9
Maybe this is a problem, since now the numbers are harder to translate into a rating scale from 1 to 10
Option C) I count every interaction separately
item 1 click | item 1 refresh | item 1 read
john 3 1
jane 1 1
Here the problem is that "reading about" an item is probably only done once.
Independent of whatever option I choose, my idea is to first find similar users using something like cosine similarity or pearson correlation. Then pick the top 10 to 30 users from that list and compile a toplist of their favorite items. From that list, I will then recommend items that the current user has had little interaction with in the past.
Is this something that could work? I am worried that finding similar users will eliminate the chance of finding interesting (new) items for the current user.
What you suggest sounds reasonable. Your concern about not finding new items is a reflection of the collaborative filtering method which is metadata-based. To find new items you would have to undoubtedly do some content analysis which would be a separate stage. For example, if your items are news articles you might try to identify important keywords for each user.

Variable Number of Plots in an MS Access Chart

I have the following problem with MS Access:
Suppose I have a list of companies with monthly performance values. I can view the performance of a single company in a chart by hooking the chart into a query with a Month column and a Performance column.
Now suppose I want to display a chart for N companies. I could theoretically do this if I were to generate a query with a Month column and N Performance columns (one for each company). Is there any way to create a query with a variable column count like this? I have a SQL backend that I can use if necessary, and I'm fine with putting together any VBA code necessary to support it. The only impediment I'm seeing is that I'm stuck using MS Access, which I am not very familiar with.
So here are my main questions:
Is this even possible?
How would I go about tackling this issue? I'm trying to minimize research time, so it would be great if I could just get pointed in the right direction.
Thanks!
With this table:
company pmonth performance
1 1 10
2 1 8
3 1 15
1 2 15
2 2 5
3 2 25
1 3 5
2 3 4
3 3 20
I create this query:
SELECT p.company, p.pmonth, p.performance
FROM MonthlyPerformance AS p;
Then change the query to PivotChart View and drag company field to "Drop Series Fields Here", drag pmonth to "Drop Category Fields Here", and drag performance field to "Drop Data Fields Here".
If you prefer, you can create a form using the same query SQL as its data source, then set the form's Default View to PivotChart, and set up the chart the same way as I did for PivotChart view on the query.
If that's not what you want, give us some more information about the type of chart you want and the context in which you will display it.