Drupal Profile2 / Field collection sorting records - drupal

As continuation of this article Drupal nested / complex / sub content types I have a new question.
As described, using Profile2 and Field collection I've managed to create multi-user CV management system:
Created a content type called CV.
Added a field_collection field to CV called education and allow unlimited entries.
Edited the education field_collection item and add a date field and a text field.
Did the same for work experience and any other fields.
Unfortunately, users should be able to reorder the records (date-text), e.g. to put some of the entries before others. For the moment being they appear in the order of their input.
How to achieve that?
Thank you!

The image below shows a field collection I have made with 3 fields.
One the left of each collection item is a drag handle.
You can re-order content using these handles.

Related

drupal move specific field to another field

I basically have a content type named "articles", and in this content type there is a reference field (that let me put unlimited data) called authorsref and a text field which as well let's me add as many as I want.
Both of this fields are called "authors".
What I want to do is move a specific reference field, to the text field, and then delete that reference field.
So for example, there are a hundred articles already, there are actually thousands and let's say 40 of them have a reference field with the author test1 amongst other reference fields and let's say as well that 60 of those hundred articles have as well a reference field of test2.
what I need to do is to somehow go over all the articles and where test1 and test2 reference fields are present, move them from the reference field authorsref to the text field authors.
I am as well a newbie and I have been trying to get this to work for the last three days and I just don't know how.
Please help, and thanks so much!
I think you need to use hook_update_n + batch.
hook_update_n - With this hook you can update some values in your DB.
Batch - you need to use batch for operations that may take a long time. (You don't want to time out PHP, you wont worry about it with batch).
Some examples here and here.

Showing count of content based on the select list values Drupal 7

I have a requirement in which I need to show some content along with its count based on values in a select list. I wanted to display the allocated,released and resigned resources of a particular department in a selected date range. Using views, date range and department fields are created as exposed filters.
Created a content type for creating resources. The Resources content type is having action as a select list with values allocated,released,resigned. Department is another select list and date field is also added.
Please help me with an answer if views module is not enough. Provide some other solutions also. I'm using Drupal 7.
I figured out how to show node count in views. In my view I’ve some exposed filters and passed my select list cck field as contextual filter. If no result available I made the view to display summary as row count. In the template file, I’m planning to do some calculations for showing the resources count in and out of the project. Please correct me if there is anything wrong in this approach.

Table input for view

I would like to have the user enter order items on my order form as a table where they input the Qty and Prod #. I've not programmed with that type of field so a blank line would initially display for a new order. They would type a Qty and an item number in the fields and hit enter. When they hit enter from either field, what do I program to check the validity of the two fields. Plus I need the item number to be a drop down/type ahead field. Does anyone have an example of this type of thing they could send me? It would be looking at a view in the product catalog db. Also, after they enter an item to order, that "doc" should get stored/saved and a new blank line should open up.
What type of control do I need to use and should these items be stored in their own form or on the main order document? Could use some guidance here. Thanks.
The question you have is a little broad but I will make a couple suggestions if I can.
You have the main order doc. Then a repeat control with each item. Filter each item by a uniqueID that allows you to join the main doc to the child docs. Each item should be a separate document. You then need to make the items in the repeat control editable.
There is a lot of things going on here and I think you need to get started somewhere. I think the first step is to do a repeat control with response documents.Xpages, Inherited documents in view panel by using #Unique

Drupal nested / complex / sub content types

I am trying to create multi-user system for CV managing using Drupal.
The basic idea is:
Each User has his own CV.
Each CV has several predefined sections as Education, Work experience, etc.
Each Section consists of unlimited {Dates range - Text} entries.
I've created two new content types - CV and Date_Range_Text but I cannot link them together, e.g. to make Date_Range_Text a complex/nested content type, used in the CV's sections entries.
Do you have any ideas?
Thanks.
I would use the Field Collection module.
Create a content type called CV.
Add a field_collection field to CV called education and allow unlimited entries.
Edit the education field_collection item and add a date field and a text field.
Do the same for work experience and any other fields.
Now when someone creates a new CV they can add unlimited education items, each consisting of a date and some text.

How to fetch pretty advanced relation in Drupal 6 - Views 2?

I have three content types: Artist, Artwork, Exhibition. An Exhibition has a field 'artworks' (unlimited values). An Artwork has a field 'artist' (1 value, required).
And there is the relation I can't seem to find with Views: I want all Exhibitions an Artist ever participated in. Which means: on the Artist page, show all Exhibitions all Artworks of this Artist were ever in.
The problem (I think) is that one field (Exhibition.artworks) has many values. Yet Artwork.artist has just 1 value.
I don't know what the problem is =) but it's not working and I've tried a million things. At this point, I'll accept writing SQL queries, but the drupal content database is so incredibly untransparent that I have no idea what to query and how.
Obviously I'd be happiest with an unhacked Views solution, but I'm not getting my hopes up. Anyone experience with relations like this?
You can build dependent relationships that should help you to accomplish this. Use a relationship (Artwork) on exhibition.artworks and a relationship (Artist) on (Artwork).Artist
It would be easier to understand what you're doing with exports of the views & content types.
The database structure for content types in Drupal works as follows;
The node is the base table, with nid as index. Your content types have their own tables, content_type_XXXXXX with all single entry fields (that aren't shared among content types) members of that table. Multiple entry and shared fields get their own table content_field_XXXXXX. All of the tables relate on the nid field, and multiple entry fields use a "delta" to indicate the entry order.

Resources