how to create view of field collection in drupal 7 - view

when i am creating a view of field collection they give error when we add fields in view
error is that:
An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /en/admin/structure/views/view/new_page/preview/page/ajax
StatusText: error
ResponseText: Exception: Invalid field name given: field_translations is not a Field Collection field. in FieldCollectionItemEntity->__construct() (line 210 of /home)
how handle this problem

To create field collection view you need to add relationship to the Field collection first and than you can use it. The above error seems like you're using a wrong field.

Check if the field field_translations still exists as a field collection field on your installation (probably not anymore). Apparently removed fields remain inside the database table of Field Collection.
To solve this:
Take a database backup of your current installation (just to make sure)
go to your database, find the table field_collection_item and
explore it
find all the items referencing to field mentionned in the error (in
this case this would be field_translations)
Remove all these items and clear the cache of your Drupal
installation
(Source)

Related

Is there a way how to recreate a field for a Dynamics CRM entity?

Our particular situation is that we have a DateOnly field and would like to change it to DateTime field supporting also the time portion. The operation is not allowed in UI and it's also stated in the documentation. Hence, I excepted deleting the field and recreating it with the new setting would work.
However when I try to create the field with the same name the Duplicate Field Name error is thrown. I've read the column actually still exists behind in the DB.
Of course, I could create a field with a new name but it would require changing all related workflows and code customizations.
Is there a way how to overcome this issue?
Deleting and recreating an attribute with the same name but different type should work - of course with the caveat that you have to remove all dependencies before deleting the attribute and recreate them with the new attribute.
The Duplicate Field Name error seems to indicate that the field still exists - perhaps the entity needs to be published after deleting.
You may also find the XrmToolbox tool Attribute Manager helpful.
It allows you to migrate an attribute and its data to a new attribute.

Servicenow - Service Catalog Reference Field - Insert different column than the display value

Let me describe my problem:
I have a table for all my IT-Services. I reference to this table more than once, for different purposes. Most of the time I need to reference to the name of the service. That's why I keep the name as displayed value.
One Column of that table is a service_id (custom field) which is for example "Service_004". Now in a catalog request Item the User has to fill in the service_id in a reference field.
But since I have the name as displayed value, and I need it in other forms, I am unable to reference to the service_id.
Using the variable attributes field I managed to let the service be found using the autocomplete function. But in the reference field I still get the servicename. I know that I can change the display value in the dictionary, but this breaks other functions. So what I need is to change the display value just for one reference field.
Also I tried to create a new table called IT-Services2 with reference to my table IT-Services. Then I switched the display to true in the new table for my service_id, but this will even change it in the parent table.
Perhaps an onChange client script utilizing g_form.setLabelOf() ?
http://wiki.servicenow.com/index.php?title=GlideForm_(g_form)#setLabelOf
Maybe I'm not fully understanding your question...
I ran into this issue before, what you can do is create select box variable and use an on load client script to populate the list with the service_id(s) from the table you are referencing.
I would write a script include to pull the data from the table and call it from the client script via GlideAjax.

Invalid Attribute name while getting collection : Magento

I am getting the following error -
Fatal error: Uncaught exception 'Mage_Eav_Exception' with message 'Invalid attribute name: subcategory_id.' in /home/dev-cm/public_html/magento2/app/Mage.php:536 Stack trace: #0 /home/dev-cm/public_html/magento2/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php(1155)
Mage::exception('Mage_Eav', 'Invalid attribu...') #1 /home/dev-cm/public_html/magento2/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php(1240)
I have actually added a custom field directly to the table in the database. It was already a custom table too. For making entries too setSubcategoryId() method didn't work. So I saved it through making db connection and saving it through query which is not good idea.
But getSubcategoryId() method worked for getting this field value from collection. Now I am trying to get records for filtering through this field but it's not working and showing the above error. Below is the code that's showing this error -
Mage::getModel('catalog/merchant')->getCollection()->addFieldToFilter('subcategory_id','123');
I searched about it a lot but didn't found any solution. I also flushed magenta cache and re-indexed data but it didn't work. I think I need changes in core files but I don't know what and how to do them.
So I need to get setSubcategoryId() method and the above error fixed for this custom field
i guess you are extending the wrong collection... you are using (extending) an eav collection while you should extend a mysql4 collection.

how to customize joomla db sql error messages and how to prevent duplicate entries

my showtime table contains following fields,
id, name, showtime where id is a int type auto-increment field(pK). showtime time type unique field .
when I try to add a showtime(duplicate value) to showtime field($row->store()) it shows the following joomla error message.(I used $row->getError() method)
TableShowTime: :store failed
Duplicate entry '10:30:00' for key 'showtime' SQL=INSERT INTO `jos_myextension_showtime` (`id`,`name`) VALUES ('0','evening')
I want to know is there any way to show only the db error message without showing sql query.
I have an idea to check the duplicate values using a query before insert, is it a good practice? Plz Help.
I think that if you don't want to display the query, then you shouldn't show the other part of the error message neither (don't tell the user you're trying to insert a duplicate key). A simple fix to this might be something like this:
if ( $row>getError() ) {
echo "Could not store [...]";
}
If this is a custom component, you could also modify your table class to customize these error message, or even show distinct error messages depending on the error number.
I hope it helped!

How to display records that violate validation in Access insert query?

Using Access 2007. I'm trying to insert records into a table with data validation rules, and I'm getting the error message that Access didn't add "1543 record(s) due to validation rule violations." Is there any way to make Access display the records that failed validation, so I can figure out which values are breaking my validation rules? I looked all over Google but couldn't find anything to accomplish this.
Perhaps you could copy the records from the results of the query, then paste into your target table. Access will create a new table called something like Paste_errors which would contain the records which failed to insert.

Resources