I would like to perform a random sort of data coming from database using SOLR.
I found that SOLR has already a dynamicField that I can use with random field type :
<types>
...
<fieldType name="random" class="solr.RandomSortField" />
...
</types>
<fields>
...
<dynamicField name="random*" type="random" indexed="true" stored="false"/>
...
</fields>
But I don't understant how to fill the random* column. My data are issues from data import using SQL query.
Must I fill the column in db-data-config.xml and in which way ?
Thanks for any help.
Related
When trying to retrieve an entity from Dynamics CRM using FetchXML one of the attributes appears to be missing.
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
<entity name="sb_eventbooking">
<attribute name="sb_name" />
<attribute name="sb_bookeridname" /> < problem here
<attribute name="createdon" />
<atrribute ........
There are 18 attributes in the FetchXML file but when running the application only 17 are available:
And sb_bookeridname is missing. If I go into the FetchXML file and enter an attribue that I know doesn't exist then I get an error:
'sb_eventbooking' entity doesn't contain attribute with Name = 'fakeattribute'.
So the application accepts there is an attribue called 'sb_bookeridname' but I cannot get a value from it. I know there can be issues with columns with null values but other attributes don't seem to have this problem. I do use this check on all attributes and get values for all the other attributes:
if (entity.Attributes.Contains("sb_bookeridname") && entity.GetAttributeValue<String>("sb_bookeridname") != null)
{
booking.bookeridname = entity.GetAttributeValue<String>("sb_bookeridname");
}
Edit 1:
I believe you have a lookup field with schema name: sb_bookerid. When we create a lookup field, CRM automatically creates a column in the table to store the text value corresponding to lookup. So when we create a lookup field sb_bookerid, then CRM will automatically create a column in the sb_eventbooking entity by the name sb_bookeridname.
This is the reason you do not receive an error on executing FetchXML query because a column with the name exists but CRM restricts from showing its value. So if you want to retrieve the value in sb_bookerid field, please use following -
if(entity.Contains("sb_bookerid"))
{
bookeridname=((EntityReference)entity.Attributes["sb_bookerid"]).Name
}
Hope it helps.
Here is cleaner way:
bookeridname = entity.GetAttributeValue<EntityReference>("sb_bookerid")?.Name;
Suppose I have a field in a view like below:
<field name="some_name" widget="radio"/>
where,
some_name = fields.Selection([
('val1', 'val1'),
('val2', 'val2'),
('val3', 'val3')
])
Now, suppose I have another view. There I want to get the field using xpath like:
<xpath expr="//field[#name='some_name']"></xpath>
and there I want to display only the first two options of some_name. In odoo 11, How can I do that ?
You should try this in XML file:
<field name="some_name" attrs="{'invisible':[('some_name','==','val3')]}" invisible="1"/>
When arithmetic values in Fetch a ProxyTypesAssembly must be used in order to know which types to cast values to.
My Fetch XRML looks like:-
string fetchXml = string.Empty;
fetchXml = #"<fetch mapping='logical'>
<entity name='***'>
<all-attributes />
<filter>
<condition attribute='****' operator='eq' value='067' />
</filter>
</entity>
</fetch>";
Well, you either can use a Proxy Class, or query the metadata to get the attribute types, or, since attribute types are immutable, if you know the type of the attribute when you're writing the code you can hardcode it.
If you are using latebound, then you better use QueryExpression for your queries when obtaining this kind of error.
What I'm trying to achieve is simple: I made a wizard that asks the user to provide a RMA ID (that's a pop-up). Once that is submitted, I perform some operations in the backend and build a list containing all the other products in the order that's being RMA'd. I then need to ask the user to verify that all those products are in the physical RMA.
Now, I'm stuck right after building my list. How can I send that list to OpenERP, have it generate a TreeView from it so that the user can individually select products that have been located (and the ones that haven't)?
I'm assuming I'll need an additional view.xml, buy I have no idea about:
1) What to insert in the <field name="arch" type="xml> node
2) How to send my custom list/object to OpenERP/odoo
In other words, I have a list that I'm trying to send to OpenERP/odoo to be displayed in a TreeView. How?
Thanks for your help!
#Pier
Considering for Odoo-v8.
From my understanding you can try the following:
In you wizard you need to have a one2many field say product_line_ids, which will shown in your wizard.
So you will two classes, see the following structure
class rma_wizard(models.Model):
_name = 'rma.wizard'
rma_id = fields.Many2one('rma.master',string="RMA")
prodcut_line_ids = fields.One2many('product.line','wizard_id',string="Products")
#api.onchange('rma_id')
def rma_id_change(self):
code to get the list of products and use the following code to add in the wizard
final_products_list = []
products= {}
for product in product_list:
result = {}
result.update({'product_id':product.id})
final_product_list.append(result)
self.product_line_ids= final_product_list
class product_line(models.Model):
_name='product.line'
wizard_id = fields.Many2one('rma.wizard',stirng="RMA")
product_id=fields.Many2one('product.product',string="Products")
select_product=fields.Boolean("Select")`
and the Views:
<record name="rma_wizard_view" model="ir.ui.view"/>
<field name="name">RMA Wizard</fieeld>
<field name="model">rma.wizard</field>
<field name="type">form</field>
<field name="arch" type="xml">
<field name="rma_id"/>
<field name="product_line_ids>
<tree string="Products">
<field name="product_id"/>
<field name="select_product"/>
</tree>
</field>
</field>
</record>
Now you can put the check mark select as per your need and perform operation on it
Hope this helps!!
how could i get only the rows where the ProcedureID = 6104 in my xml database field?
<CDirData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://Fnet.ESB.Schemas.CentroDirectivo.CDirData">
<ProcedureData xmlns="">
<ProcedureId>6104</ProcedureId>
<CentroDirectivo>SGRP</CentroDirectivo>
</ProcedureData>
<SolicitudData xmlns="">
<SolicitudId>MFom635230432391710791</SolicitudId>
<Status>Iniciado</Status>
I've been trying something like
WITH XMLNAMESPACES (
'http://www.w3.org/2001/XMLSchema-instance' AS "xsi",
'http://www.w3.org/2001/XMLSchema' AS "xsd",
'http://Fnet.ESB.Schemas.CentroDirectivo.CDirData' AS "de")
SELECT [Message].value(
'(/de:CDirData/de:ProcedureData/de:ProcedureId)[1]', 'nvarch
but always returns null rows ...
Thanks in advance
The complication here is the default namespace defined at the root.
One workaround is to define your query in terms of local-name
//*[local-name()='ProcedureId' and text()='6104']