|
|
#1 |
|
Участник
|
partylist в fetch запросе
Доброго времени суток!!
подскажите пожалуйста как составить fetch запрос если в нем участвует поле с типом partylist ?? я хочу получить такие звонки у которых в поле получатель( to ) которое имеет тип partylist стоял бы БП account var account=beResult.attributes["gar_account"].value; ............ ......... .......... var phonCallsFetchXml = "<fetch mapping='logical'><entity name='phonecall'>"+ "<all-attributes />"+ "<filter type='and'>"+ "<condition attribute='to' operator='eq' value='"+account+"' />"+ "</filter>"+ "</entity></fetch>";
__________________
rurik |
|
|
|
|
#2 |
|
Moderator
|
Надо делать достаточно сложные объединения с partylist с различными фильтрами. Проще всего построить шаблон при помощи расширенного поиска и просто его экспортировать. В 2011 есть кнопка, в 4.0 нужно построить запрос, выполнить его, вернуться в запрос и в строке адреса выполнить следующее:
Код: javascript:window.clipboardData.setData("Text", resultRender.FetchXml.value);
__________________
http://fixrm.wordpress.com, снятие/наведение порчи. Быстро, дорого, гарантия. ![]() MS Certified Dirty Magic Professional
|
|
|
|
| За это сообщение автора поблагодарили: u.rastegaev (1). | |
|
|
#3 |
|
Участник
|
да спасибо это помогло, но встала другая проблема:
у меня был вот такой запрос Код: "<fetch mapping='logical'><entity name='phonecall'>"+
"<all-attributes />"+
"<filter type='and'>"+
"<filter type='or'>"+
"<condition attribute='gar_subject' operator='eq' value='"+subject+"' />"+
"<condition attribute='gar_subject_2' operator='eq' value='"+subject+"' />"+
"<condition attribute='gar_subject_3' operator='eq' value='"+subject+"' />"+
"<condition attribute='gar_subject_4' operator='eq' value='"+subject+"' />"+
"<condition attribute='gar_subject_5' operator='eq' value='"+subject+"' />"+
"</filter>"+
"<filter type='or'>"+
"<condition attribute='gar_main_account_phonecall' operator='eq' value='"+account+"' />"+
"<condition attribute='regardingobjectid' operator='eq' value='"+account+"' />"+
"</filter>"+
"<filter type='and'>"+
"<condition attribute='createdon' operator='on-or-after' value='"+ fStartDate+"' />"+
"<condition attribute='createdon' operator='on-or-before' value='"+ date+"' />"+
вот сюда надо вставить запрос с partylist
"</filter>"+
"</filter>"+
"</entity></fetch>";из расширенного поиска я получил для partylist'a вот такой запрос Код: <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true"> <entity name="phonecall"> <attribute name="subject"/> <attribute name="statecode"/> <attribute name="prioritycode"/> <attribute name="scheduledend"/> <attribute name="createdby"/> <attribute name="regardingobjectid"/> <attribute name="activityid"/> <order attribute="subject" descending="false"/> <link-entity name="activityparty" from="activityid" to="activityid" alias="aa"> <filter type="and"> <condition attribute="participationtypemask" operator="eq" value="2"/> </filter> <link-entity name="account" from="accountid" to="partyid" alias="ab"> <filter type="and"> <condition attribute="gar_inn" operator="eq" value="1"/> </filter> </link-entity> </link-entity> </entity> </fetch> и собственно вопрос как вставить часть последнего запроса выделенную красным в первый запрос ?
__________________
rurik |
|
|
|
|
#4 |
|
Moderator
|
Почему бы весь запрос не построить при помощи расширенного поиска?
__________________
http://fixrm.wordpress.com, снятие/наведение порчи. Быстро, дорого, гарантия. ![]() MS Certified Dirty Magic Professional
|
|
|
|
|
#5 |
|
Участник
|
насколько я понимаю расширенный поиск не позволяет включать related entity conditions, коим мое и является, в группы and или or, а мне именно это и нужно
__________________
rurik |
|
|
|
|
#6 |
|
Moderator
|
Ограничения по связанным записями? Да полно вам! Вот связи N:N - да, не выйдет. Плюс еще ряд ограничений. А вообще ничего сложного в синтаксисе fetch нет. В SDK он изложен убого, ничего не скажешь, но приводимые там примеры вполне просто поддаются разбору и анализу.
__________________
http://fixrm.wordpress.com, снятие/наведение порчи. Быстро, дорого, гарантия. ![]() MS Certified Dirty Magic Professional
|
|
|
|
|
#7 |
|
Участник
|
ну а всетаки ? вот такой запрос
Код:
"<fetch mapping='logical'>"+
"<entity name='phonecall'>"+
"<all-attributes />"+
"<link-entity name='contact' from='contactid' to='gar_contacts_call' alias='contactBP'>"+
"<attribute name='parentcustomerid' />"+
"</link-entity>"+
"<filter type='and'>"+
"<filter type='or'>"+
"<condition attribute='gar_subject' operator='eq' value='"+subject+"' />"+
"<condition attribute='gar_subject_2' operator='eq' value='"+subject+"' />"+
"<condition attribute='gar_subject_3' operator='eq' value='"+subject+"' />"+
"<condition attribute='gar_subject_4' operator='eq' value='"+subject+"' />"+
"<condition attribute='gar_subject_5' operator='eq' value='"+subject+"' />"+
"</filter>"+
"<filter type='or'>"+
"<condition attribute='gar_main_account_phonecall' operator='eq' value='"+account+"' />"+
"<condition attribute='regardingobjectid' operator='eq' value='"+account+"' />"+
"<condition attribute='contactBP.parentcustomerid' operator='eq' value='"+account+"' />"+
"</filter>"+
"<filter type='and'>"+
"<condition attribute='createdon' operator='on-or-after' value='"+ fStartDate+"' />"+
"<condition attribute='createdon' operator='on-or-before' value='"+ date+"' />"+
"</filter>"+
"</filter>"+
"</entity></fetch>";вот 1) я правильно объявил связанную сущьность? 2) в строке выделенной красным я хочу обратится к полю связанной сущьности. как правильно это написать? заранее очень благодарен за мудрые советы)
__________________
rurik |
|
|
|
|
#8 |
|
Moderator
|
Уважаемый коллега, я вспоминаю синтаксис исключительно когда у меня возникает потребность сделать запрос. Как правило я использую расширенный поиск. Если не выходит этот фокус, я делаю запрос через код и конвертирую его в fetch. Так или иначе в педагогических целях я не буду писать его за вас. Может быть кто-то еще. Пишите в личку.
__________________
http://fixrm.wordpress.com, снятие/наведение порчи. Быстро, дорого, гарантия. ![]() MS Certified Dirty Magic Professional
|
|
|
|
|
#9 |
|
Участник
|
педагогические цели это приятно))
кстати проблему я решил, правда немного по другому))
__________________
rurik |
|
|
|
|
| Опции темы | Поиск в этой теме |
| Опции просмотра | |
|