Drupal Views Entity Reference Limiting results - drupal

I have a lot of experience with Drupal 7 views but I am running into a roadblock and I am wondering if what I want to do is even possible.
Here is the scenario. I have two content types - Game and Score.
Scores reference Games via entity reference. I want to create a view that shows all of the games. Easy of course. Then I added the relationship to bridge to the content that is referencing game. This allows me to pull score field data into the view fine.
Here is the issue: Now I want to limit the view to show each game node only once regardless of how many score nodes exist that reference it. I only want the score that is the highest to be displayed with the game.
Is this clear? I need some sort of aggregation on the score nodes data I believe.

Related

Dynamics AX 2012 R2 - swapping out a preview pane dynamically depending on the record selected

I have a problem I'm trying to solve and I'm really not sure I'm, A) solving it the correct way, and B) able to do what I want.
I have a List Page that is a basically a summary table (transportation table) that has a record in it for every Sales, Purchase, and Transfer order that we will ship. With it is a pile of rolled up information and such that's common from the 3 sources. We use this table on a few list pages and link out to where we need to. This was all built by someone else, but I'm maintaining some parts around it.
I've gotten a request to have the preview pane on a summary table based list page show the lines from the source order. So, if a "sales order" is selected in the grid, show the lines in the preview pane for the "sales order" that was selected. Same for a purchase order and transfer order.
So, my idea, based on pure ignorance and not a ton of experience with Dynamics is that I would just swap out the preview pane based on the source order. The SalesTableListPagePreviewPane for instance has already been updated to work with linking to this summary table. So, I wanted to just change the part reference at runtime.
I've managed to get the FormRun on a list page interaction class from the datasource. I've managed to get a list of the parts via the PartList object. But, I have no idea how to continue on to actually swap out a part reference.
Am I heading down the correct path? Is this a completely wrong Dynamics AX pattern?
Your assumption, that you can dynamically (run-time) change the parts of the form, is wrong.
Listpages especially are quite static, the only code available through interaction classes. It has the benefit that a listpage can be easily deployed on Sharepoint Enterprise Portal.
You have several options:
Use 3 different listpages for each type of transport
Use a common relation table with 3 sub-tables (sales, purchase and transfer)
The last option will enable you to do an outer join on the 3 sub-tables.
The common relation table could be a union view, but I doubt it will perform well.

How can I design these business objects for querying and reporting?

I need some help thinking about the design for my business objects.
Our database records the daily entry and exit times for the comings and goings of the employees in our company. Each record also stores the UserID of the employee, the ID of the work station the employee signed in at and obviously the date.
A user can have many Entry and Exit times at any number of work stations at any given date.
The record looks something like this:
SignInID | UserID | WorkStationID | DateTimeEntry | DateTimeExit
I have a reportviewer on my asp.net form that must display reports of this entry and exit data grouped by date, work station or user.
For example it must display all data for a specific date (and within that, ordered by work station).
Or it must display all data for a given work station (and within that, ordered by date) and other similar formats.
Until now I had a monstrosity of a method where I selected the data and constructed some kind of makeshift datatable to display on my form.
I now want to redesign using objects, but I don't know how to design the hierarchy i.e. what object contains the collection of entry and exit times, and how to I make it flexible enough that I can query it (using Linq, perhaps?) based on the various display criteria?
I'm really interested in learning more about designing objects and using the correct terminology for what I'm trying to do, so if you can point me to some articles explaining these concepts it would be very helpful too.
EDIT: Okay, at least I've learned something new. What I'm trying to do is ORM - Object-relational mapping - and .NET has an inbuilt ORM tool called Entity Framework. So far so good. Now I have to see whether it can help me figure out how to organize my data.
Well, I actually have to thank the community for not answering my question, because I got to learn a lot about Entity Framework, Linq (and its limitations with Entity Framework in .NET 3.5) and a whole bunch of other things to answer my own question.
What I ended up doing was create an Entity Model of my Database using Entity Framework and thus created the Business Objects I needed to organize my data. I learned that my data isn't designed in a hierarchy, rather there are associations such as Workstation and User that each time entry records contains. I used a Linq-to-Entities query to select the data I wanted and flattened it out using its associations (example Time.Workstation.Name or Time.User.FullName) so that in the end, my projected object contained all the data I wanted in each row of my report. My projected object was actually a POCO I created for the purpose of holding the queried data and making it available as a datasource for my rdlc report.
Finally I bound the results of my query to a Reportviewer's ObjectDataSource which connects to the rdlc file that I was able to define to my liking: i.e. Either displaying the Workstation first or the User, or whatever associated information I wanted to display.

Drupal 6: sort display of node references

I have a content type that references multiple nodes, and I need a way to sort the display of those referenced nodes.
Any ideas?
--- EDIT ---
Clarification:
I'm not using views, but rather am using my own queries.
I have a bunch of teachers (teacher content-type), and some conferences (conference content-type).
Within the conference content-type I want a node-reference field set to handle multiple teacher selections. But I need to be able to manually order them independently. What that means is that each individual conference needs to be able to sort the order of the particular teachers selected.
That's the ideal situation, but not the way I'm actually doing it.
What I'm ACTUALLY doing to jury-rig this thing is to have separate node-reference fields (teacher 1, teacher 2, teacher 3 etc.). Each node-reference field independent of the others.
It makes for a mess when it comes to creating views or composing db queries.
I know what I'm looking for is all but impossible, but I thought I'd run it by the Drupal gurus here anyway...
--- EDIT 2 ---
Further clarification:
Another way to do what I want, but is really impractical, is to create a separate nodequeue for each conference. Then you could select a handful of teachers associated with each conference and order them via the nodequeue. - That should help with visualizing the problem. But as a solution, it's even more messy (in terms of administration) than the one I'm currently using.
Also: I should mention that we're talking about 40 to 80 conferences, and 100-200 teachers. Just to get an idea of why I'm looking for a more elegant solution than the two I mentioned above.
Node reference with autocomplete widget gives you reordering capabilities when number of values set to 'unlimited'. Maybe not the most comfortable, but works.
I'm assuming you're using Views since you mentioned "displays". You can always change the order of the view fields from the Views UI but the order will be static (all items will have the same order).
If you want each item to have a potentially different order for the fields maybe you can set up a parent child relationship where the child item is ordered dynamically.

Measurement sheets in Drupal 6

I'm doing a project for a surveying company in Drupal 6. Ultimately, employees will need to enter measurements into a new content type. Currently they do it in a big Excel spreadsheet that has a bunch of macros to do calculations between cells (Meters to Feet, m^2, some pricing stuff).
My question is:
How would one go about replicating the functionality of this spreadsheet best in Drupal 6, keeping in mind the amount of data the employees using this system gather varies between projects (I.e., 3-floor house versus 1-floor with basement; etc.).
I have two ideas so far:
Create a new content type and populate it with CCK fields. Use Sheetnode's CCK functionality to drop Sheetnode CCK fields to replicate the spreadsheet exactly. Use Views to display this data other ways.
Create a new content type and populate it with CCK fields. Use Views (and possibly something like Views Calc) to get varying measurement values.
That said, I'm completely open to suggestions outside of these two implementations.
Thank you!
I dont have an answer so much as a caution. I did a project where a number of pieces of content were rendered simultaneously on a page, each piece being in its own node. The down side to multiple nodes is the performance hit you will take having at least one (possibly complex) query per node.
So in this case, if there were many many lines in the sheet, and each line was a node, you might take a pretty heavy performance knock.
This might be acceptable - but I thought I'd give you the heads up.
This might be one of those times where its best to actually create a purpose-built mechanism on-top of the Drupal API instead of using nodes+CCK.
Like I said, I could be being over cautious. It depends on your exact usecase.
HTH!
This seems like the kind of question http://drupal.stackexchange.com was made for...
I ended up doing this with jQuery, Measured Value Field and Flexinode; see: Auto-updating width/length/area using jQuery and Drupal6

Drupal node demystified

I'm new to Drupal, and wish to understand how this platform works.
Specifically, I'm mystified by the Node object.
What is it, how does Content-Type get in?!
It seems like the whole of Drupal is just nodes, nodes, nodes.
Would love to hear you insights.
The node, in Drupal, is an odd animal when you first encounter Drupal, but once you get it you'll find that it's quite useful.
A Drupal Node is a unit of information. Usually, it's a unit of interrelated information that for the site is not usefully divisible. For example, if you had a node that represented people and their addresses, you could split it into address nodes and people nodes and associate them, but unless you've got functionality that displays how many people are at a given address, it's not useful to split it into two nodes, and better to keep them together as one unit. Consider: If you were sorting the data out onto index cards, or pages of paper, would you list the information together, or would it be more useful to keep it apart? If together, then they probably belong together on a node.
Since most of the data on a Drupal site are nodes, it's useful to classify the nodes so you can find the ones you're interested in. One of the most basic of these classifications is the Content Type, which is basically what kind of information the node represents, and is not changeable once created. Each Content type has it's own separate form for creating and editing the node type, and represents a different type of information. Page nodes are nodes that represent static pages on your site - like an About page. A Story node represents an article or story which should show up in lists of content. A Blog node would represent a blog entry... in Drupal 6 you can create as many Content Types as you like.
Once you go beyond Content Types, there's quite a lot of different ways to classify your nodes. CCK (The Content Construction Kit) is a wildly useful one, and it's so useful that in Drupal 7 most of the functionality in CCK has been included in the core of Drupal. CCK allows you add many types of fields to a node out of the box, and then there are other modules (Filefield, Imagefield, Link, Location) that create new field types to add.
In core, another way of sorting out your nodes is the Taxonomy module, which allows you to define vocabularies of tags or terms that can be assigned to nodes. These terms can be defined by the site admins ahead of time, or they can create a 'Tag' vocabulary which allows users to create terms as they create or edit their nodes.
A node is a content container. Nearly all content in Drupal resides in nodes. Non-content data (e.g. users) does not typically reside in nodes. As most data on a website is content, nodes are a central concept in Drupal. There are several ways to assign content types to nodes, but the most common is the CCK module.

Resources