Is there a bug in the Advanced Find in MS CRM 2015 online, when in recursive queries? Example: Find Account Branches that belong to Account Branches - query-builder

No matter what I have tried, I was unsuccessful in getting the Advanced Find feature of MS CRM 2015 online to show me Active Accounts that are of type Branch that have as their parent have an Account type again of Branch.
I have checked and re-checked the data but perhaps there is something wrong with my query in the Advanced Find feature.
Or there is a bug to it.
I have run this query in SQL as well, we have a BigData db that holds our CRM data and there it reveals the correct results (of course).
Here is my query so that you can see:
--BRANCH OF A BRANCH
select [dbo].[fn_getDescFromCRMguid](a.[Parentaccountid]) as [ParentAccountName],
--[fn_getDescFromCRMguid] udf is just a look-up for descriptions and names
( select left(a3.[etf_accountlevel],6)
from [Stg_CRMAccount] a3
where a3.[accountid] = left(a.[parentaccountid],36)
) as [ParentAccountLevel],
[dbo].[fn_getDescFromCRMguid](isnull(a.[owninguser], a.[owningteam])) as [OwningEntity],
a.*
from [Stg_CRMAccount] a
where a.[statuscode] = 'Active::1'
and a.[etf_accountlevel] like 'Branch%'
and a.[Parentaccountid] is not null
and exists (
select 0
from [Stg_CRMAccount] a2
where a2.[statuscode] = 'Active::1'
and a2.[etf_accountlevel] like 'Branch%'
and left(a.[Parentaccountid],36) = a2.[accountid]
)
order by a.[Parentaccountid],
a.[name],
a.[address1_city];
I am also attaching the screenshot of my Advanced Find query and please feel free to comment or let me know of any useful thoughts.
I hope some person has any idea about this because to me it is puzzling.
I have navigated into the resulting Accounts from this and then into their parent Account and it was not a Branch.
Despite the clear (at least to me) specification of the Where clause under the use of the related Entity - Account, using the relation Parent Account.
The plot thickens even more, if you remove the Account Type = Branch for the related Entity and say change the Status = Active to Inactive then it will very correctly find and show only those Branches where their Parent is Inactive.
That leads me to suspect some kind of a recursive error with the query builder they are using.
It finds Account Type = Branch twice and erroneously does not differentiate between the first occurrence which is for the outer selection and the second occurrence which would be for the nested (in the Where clause) selection.
But all that is mere speculation.
I don't really know why it can't handle it.
It begs the question in what other scenarios it can mess up recursive query builds.
Your thoughts?
and here is my fetch XML from the Advanced Find query
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
<entity name="account">
<attribute name="etf_rating" />
<attribute name="parentaccountid" />
<attribute name="etf_lastcontact" />
<attribute name="etf_city" />
<attribute name="address1_line1" />
<attribute name="etf_accountlevel" />
<attribute name="name" />
<attribute name="ownerid" />
<attribute name="etf_segment" />
<attribute name="accountid" />
<order attribute="name" descending="false" />
<filter type="and">
<condition attribute="statecode" operator="eq" value="0" />
<condition attribute="etf_accountlevel" operator="eq" value="964850002" />
</filter>
<link-entity name="account" from="parentaccountid" to="accountid" alias="ag">
<filter type="and">
<condition attribute="statecode" operator="eq" value="0" />
<condition attribute="etf_accountlevel" operator="eq" value="964850002" />
</filter>
</link-entity>
</entity>
</fetch>

Related

Odoo decorations in tree view not working?

I am trying to add decorations in an inherited tree view in odoo 13. For this I added a variable in my module
x_LCStatus = fields.Selection(selection=[('0', 'In development'),('1', 'Active'),
('2', 'Not for new developments'), ('3', 'End of life')], string='Life cycle',
default='1', store=True)
However, when I try to change the decoration in the associated tree view nothing changes from the default settings.
<xpath expr="//tree" position="attributes">
<attribute name="decoration-danger">"x_LCStatus=='3'"</attribute>
<attribute name="decoration-warning">"x_LCStatus=='2'"</attribute>
<attribute name="decoration-primary">"x_LCStatus=='1'"</attribute>
</xpath>
Any ideas what I am doing wrong?

How to reverse the results on EdgeNGramFilterFactory?

<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StandardFilterFactory"/>
<filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EdgeNGramFilterFactory" minGramSize="3" maxGramSize="15"/>
</analyzer>
Above is my query ^
Search ==> Saree
Results of EdgeNGramFilterFactory ==> [sar, sare, saree]
then the searching happens ..but products title (boost field) having value sar appears first in the list...but I want results of saree first and then remaining word
what I want ==> [saree, sare, sar]
Can anyone suggest how can I get above results.
Thanks.
edit1
rawquerystring": "saree",
"querystring": "saree",
"parsedquery": "(+DisjunctionMaxQuery(((category_name_textv:sar category_name_textv:sare category_name_textv:saree) | ((title_textv:sar title_textv:sare title_textv:saree)^0.24) | (product_id_text:sar product_id_text:sare product_id_text:saree) | ((specification_textv:sar specification_textv:sare specification_textv:saree)^0.5) | ((description_textv:sar description_textv:sare description_textv:saree)^0.5)))
I printed values of deubg=all as pointed by #MatsLindh
how can I change patter of highlighted part
(category_name_textv:sar category_name_textv:sare category_name_textv:saree)
to
(category_name_textv:saree category_name_textv:sare category_name_textv:sar)
Please suggest to achieve the above pattern.
Thanks in advance.

converting XML to CSV where different tags in XML and their respective sub tags become line items of the CSV

I am trying to get the attribute tags within accessory tag to be line items of a CSV file
I have tried to iterate using map function but im just getting one value at a time.What i want is there are two Accesory Type tag in this XML i want their respective attribute tags to become each line item in the CSV
<Accessory Type="Panel">
<PartNumber>9021447</PartNumber>
<Attribute Name="DescCode">Operating Panel, White/PI White, Low E SmartSun Tempered Glass</Attribute>
<Attribute Name="Mark_ID">41424</Attribute>
<Attribute Name="Order_Quantity">1</Attribute>
<Attribute Name="QUOTE_QUANTITY">1</Attribute>
<Attribute Name="Quote_Quantity_Extended">1</Attribute>
<Attribute Name="MarkName">0001</Attribute>
<Attribute Name="US_ENERGY_STAR_CLIMATE_ZONE">Northern</Attribute>
<Attribute Name="SubUnitID">1</Attribute>
<Attribute Name="AW_Control_2">47AoYY</Attribute>
<Attribute Name="ReferenceID">3</Attribute>
<Attribute Name="OrderPONum"/>
</Accessory>
<Accessory Type="Screen">
<PartNumber>2505930</PartNumber>
<Attribute Name="Total_Pre_Price_in_USD">208.70</Attribute>
<Attribute Name="Total_Price_in_USD">208.700</Attribute>
<Attribute Name="QUOTE_QUANTITY">1</Attribute>
<Attribute Name="Quote_Quantity_Extended">1</Attribute>
<Attribute Name="DescCode">Insect Screen, Gliding, White</Attribute>
<Attribute Name="Mark_ID">41424</Attribute>
<Attribute Name="Order_Quantity">1</Attribute>
</Accessory>
I have tried to make the attributes under accessory tag to become line items.
Expected output:
9021447|Operating Panel, White/PI White, Low E SmartSun Tempered Glass|41424
//and in the next line
25005930|208.70|1 //and so on
This is the code that i have tried
%dw 2.0
output application/json
---
payload.m2oFile.m2oOrder.Unit.*Accessory map (value, index) -> {
(index) : value.*Attribute filter($.#Name == "MarkID"),
(index) : value.*Attribute filter($.#Name == "PRODTYPE"),
(index) : value.*Attribute filter($.#Name == "UNIT_CODE")
}
Try with this approach..
%dw 2.0
output application/csv header=false
---
(payload.a.*Accessory map {
PN: $.PartNumber,
($.*Attribute map {
(($$) : $) if (isEmpty($) == false)
})
}
)
Should give you the output as follows:
PS: i had to add "a" as the root to the xml as otherwise the xml would not be well formed..

xsd:assert (complicated character verification)

Is there a way to verify that the template contains only those characters that are passed to #param ?
I considered options with xpath functions(fn:) but have not found a suitable option.
this is 2 valid xml for example:
<rule type="myRule" template="A-B-CB">
<attribute param="B"/>
<attribute param="A"/>
<attribute param="C"/>
</rule>
<rule type="myRule" template="A(C)-B">
<attribute param="C"/>
<attribute param="A"/>
<attribute param="B"/>
</rule>
and 2 not valid xml:
<rule type="myRule" template="AB-CD">
<attribute param="A"/>
<attribute param="B"/>
<attribute param="C"/>
</rule>
<rule type="myRule" template="AC">
<attribute param="A"/>
<attribute param="B"/>
<attribute param="C"/>
</rule>
perhaps there are ideas how to implement it using schematrone or otherwise?
So the set of letters in #template must be exactly the same as the set of letters in ./attribute/#param?
That is to say, distinct-values(string-to-codepoints(replace(#template, '\P{L}', ''))) must be the same set as distinct-values(attribute/#param/string-to-codepoints()).
So how do you assert that two sequences contain the same values, under permutation?
In XPath 3.1, deep-equal(sort($X), sort($Y))
In XPath 2.0, I can't think of anything better than
empty($X[not(.=$Y)]) and empty($Y[not(.=$X)])
I'll leave you to put this all together.

Connect internal numbers on freeswitch

I would like to connect two internal numbers with one, I mean if I call 499 then two phones should ring for example 123, 127.
My .xml files in directory/default looks like this:
<include>
<user id="127" mailbox="127">
<params>
<param name="password" value="xxxx"/>
<param name="vm-password" value="127"/>
</params>
<variables>
<variable name="toll_allow" value="domestic,international,local"/>
<variable name="accountcode" value="127"/>
<variable name="user_context" value="default"/>
<variable name="effective_caller_id_name" value="Extension 127"/>
<variable name="effective_caller_id_number" value="127"/>
<variable name="outbound_caller_id_name" value="$${outbound_caller_name}"/>
<variable name="outbound_caller_id_number" value="$${outbound_caller_id}"/>
<variable name="callgroup" value="techsupport"/>
</variables>
similar for 123 and 499 numbers.
How can I change it to make two phones rings(123,127) when someone calls 499?
in your dialplan you should call the bridge application like this.
<extension name="Local_Extension">
<condition field="destination_number" expression="^(1001)$">
<action application="bridge" data="sofia/internal/1001%${server-domain-name},sofia/internal/1002%${server-domain-name},sofia/internal/1003%${server domain-name}"/>
</condition>
</extension>
So if you call to 1001 then it will ring to 1001,1002,1003

Resources