2sxc News app: Show more then 1 category and role related categories - 2sxc

We are using the 2sxc module version 9.32.1 and the news-pro app version 3.1.
I am trying to make a view where I can show the items of 2 categories, but it seems I can only select one? And when I enable the function: Select more then one item, it will only show items for the first category selected.
How can I achieve this?
And I really want to connect user roles to the categories, and only show them when you are in then user role, how would I go about this?
I expect a list where I can show multiple category items.
and I expect a field with category where I can connect a user role to it.

I Sorency - it's best to put each question into a separate stack-overflow question, to keep things clean for future users who are looking for one. So I'll answer the initial question with multiple categories.
There are two ways to do this - one uses Visual Query, the other code. I will just give a general guide here:
With Visual Query https://2sxc.org/en/Learn/Visual-Query-Designer
1. First make sure you understand what it does, as I assume you haven't worked with it yet.
1. Look at how the first filter works - there you can either add more parameters (to allow multiple categories) or create a second stream with the additional filter, and then merge the results. So your query then has one list for the matches of the first parameter, and another match for the second parameter - and in the end it merges them together.
With Code you would do it in the razor file (CSHTML). There you would need to learn some LINQ and then work with the DataSource objects. This is much more technical, so I suggest you stick with the visual query for now.

Related

Showing related data in a list

I am building a page in Google AppMaker and cannot retrieve the latest record of the related data that was submitted.
In my app: I have multiple wounds, each with many inspection dates. I want to be able to list each wound, and pull up the most recent measurements (latest Length, latest Width, and latest depth)
Here is the Visual.
I have tried advanced datasource options and did not get anywhere. I was hoping to use as little app script as possible. I thought this would be easily retrievable with the bult-in widgets (I can easily do this in spreadsheet using Vlookup... but I don't know what the equivalent would be in appmaker) Any help would be appreciated, Thanks.
If you have a field that can be used as a criterion for getting the latest record, say CreationDate, then you can specify a sorting option in the relation settings.
See sample One-to-many relation setting with sorting option (screen-shot)

Drupal views - Show no exposed filter options when no results come from view

I have a problem. I have a view that is getting back no results like it should, for the context it is in. I have a list of resources (file nodes) that are associated to an organic group. For this view I use exposed filters that should only show filter options that apply to the result set.
For example, if I have only one "folder" associated with this group then I should only see one folder in the exposed filter for folders. If I have none then none should show up. The problem is that when we have none it is showing ALL the folders for the site. Same with the associated topics and other filter fields.
Currently we are using the views_hacks > views_filters_selective module to accomplish the initial filtering. But it doesn't seem to handle the case when the view has no results. And I am having trouble figuring out how (and where) to identify when it has no results so that I can just eliminate all the filter options.
Now to be a little extra honest about this, we actually copied some of the functions from the above mentioned module and improved it (for performance purposes) within a custom module we wrote. But like I said, I am having a tough time trying to identify when the view has no initial results at all.
Does anyone have any idea as to how to do this? We are running this in Drupal/Pressflow 6 with Views 3.
It turns out I just needed to set it to not empty for that field and it works fine.

Drupal data entry forms & db structure?

I'm trying to build a Drupal site in which users can input records containing data about "customers", "employees" and "sales".
I would like to be able to create a form(s) which takes data about a sale/customer/employee and can be associated with a record of a customer/employee(who made the sale)/sale.
I would also like to be able to display records showing a list of sales or customers or employees in which when clicking one record, it will open a page displaying all the relational data.
I'm new to development and am searching around like a headless chicken lol. I was thinking of using content types for sales/employees/customers and using individual nodes for each record then using something like views to displays filtered lists, but I am unsure if this is the best way to go about/structure it (maybe I should use separate custom tables or database and use a custom module to fetch the data?). It would also be nice if some of the fields can populate other fields based on it input and also if some fields can utilize a sort of auto-complete by garbing data from other records, or is that asking way too much?
Thank you for any suggestions you might be able to give me.
I, for one, would certainly prefer using a custom separate database and leave drupal databases to its own devices, if you would ever need to upgrade the site to a higher version of drupal it helps if you don't modify it, and also consider using webform (http://drupal.org/project/webform) as it makes development easier both in components and hooks.

Create a view that displays node count?

Having trouble in views creating what seems like a very simple query. Display the number (count) of nodes of a given type. I'm not finding the option in any obvious place...
How to?
You want the Views Group By module. Some more details about this module (from its project page):
This module enriches Views2 functionality with SQL Grouping and Aggregation capabilities.
Ever wanted to design a view that displays top terms for a specific node type and number of nodes for each top term? You could not build such query before, but now you can.
A new field group: SQL Aggregation is added, in Views, once you install the module. The field group has one available field: SQL Aggregation: Group By Fields. The field allows to configure many aspects of "group by" SQL clause and "count()" fields.
Currently only SQL COUNT() function is available due to a limitation in Views2 API. We are working on a Views2 patch to overcome the limitation. Patch will be submitted to Views2 project and, hopefully, applied shortly thereafter.
Maybe instead of views it is better to use light custom SQL-query, something like this http://drupal.org/node/105375#comment-1095529

Can you have a Dynamic Data Field which consists of a list of fields?

This is a purely theoretical question (at least until I start trying to implement it) but here goes.
I wrote a web form a long time ago which has a configurable section for getting information. Basically for some customers there are no fields, for other customers there are up to 20 fields. I got it working by dynamically creating the fields at just the right time in the page lifecycle and going through a lot of headaches.
2 years later, I need to make some pretty big updates to this web form and there are some nifty new technologies. I've worked with ASP.NET Dynamic Data just a bit and, well, I half-crazed plan just occurred to me:
The Ticket object has a one-to-many relationship to ExtendedField, we'll call that relationship Fields for brevity.
Using that, the idea would be to create a FieldTemplate that dynamically generated the list of fields and displayed it.
The big questions here would probably be:
1) Can a single field template resolve to multiple web controls without breaking things?
2) Can dynamic data handle updating/inserting multiple rows in such a fashion?
3) There was a third question I had a few minutes ago, but coworkers interrupted me and I forgot. So now the third question is: what is the third question?
So basically, does this sound like it could work or am I missing a better/more obvious solution?
Did you try creating a FieldTemplate that had a "ListView" of all the Fields? (the ListView would use Dynamic Data to determine which FieldTemplate to display for each field.)
I don't see why this would not be possible. Although, "out of the box", you may have to hit "edit" on each row of the new FieldTemplate's ListView to edit the values. It would be like replacing the "Order Details" link in the Orders List, with an inline List of the "Order Details".
1.) Not very nicely. Can you imagine showing a DateTime, Integers, Phone numbers, Urls, etc with just ONE user control, like text.ascx? Why not have multiple field templates and use UIHint to specify usage per column?
2.) Yes.
3.) Define basically?
regarding one to many relationships, you might have a look at the ListDetails.aspx Page Template in Dynamic Data. Hope this helps.

Resources