FetchXML Greater Than - dynamics-crm

I am using FetxhXML and I want the condition to be greater than a certain number of hours.
This is what I have:
string groupby1 = "<fetch distinct='false' mapping='logical' aggregate='true'>" +
"<entity name='opportunity'>" +
"<attribute name='opportunityid' alias='opportunity_count' aggregate='countcolumn' />" +
"<filter type='and'>" +
"<condition attribute='new_leadstatus' operator='eq' value='100000000' />" +
"<condition attribute='new_emailedtorsm' operator='eq' value='false' />" +
"<condition attribute='ownerid' operator='not-null' />" +
"<condition attribute='createdon' operator='last-x-hours' value='1' />" +
"</filter>" +
"<attribute name='ownerid' alias='ownerid' groupby='true' />" +
"<link-entity name='systemuser' from='systemuserid' to='ownerid'>" +
"<attribute name='internalemailaddress' alias='internalemailaddress' groupby='true' />" +
"</link-entity>" +
"</entity>" +
"</fetch>";
So basically on the createdon condition I would want it to be greater than 1 hour or greater than the last x hours. Is this possible?

You'll need to use the on-or-before condition and insert your own DateTime that is one hour before the current time, like so:
string groupby1 = string.Format(#"
//snip...
<condition attribute='createdon' operator='on-or-before' value='{0}' />
//snip...
", DateTime.Now.AddHours(-1).ToUniversalTime().ToString("u"));

Related

repeated data in json response spring boot

I have this SQL query
#Query( value = "select tc_users.id as userid,tc_devices.id as deviceid, tc_devices.name, tc_devices.lastupdate as hora_fecha,\n" +
"tc_positions.speed as velocidad, tc_positions.latitude, tc_positions.longitude, tc_positions.devicetime\n" +
"from tc_devices\n" +
"join tc_users on tc_users.id = tc_devices.userid \n" +
"join tc_positions on tc_devices.id= tc_positions.deviceid and \n" +
"tc_positions.devicetime=(select max(devicetime) from tc_positions where tc_positions.deviceid= tc_devices.id) and tc_users.id= ?1 ;", nativeQuery = true)
List<resumen_entity> resu(Integer userid);
This SQL query return this data
result of query in SQL workbench
but when using it with my spring project it returns this json
result of query by springboot
a really need help with this problem
I try with another type of SQL query but spring returns the same result
#Query( value = "select distinct tc_users.id as userid,tc_devices.id as deviceid, " +
"tc_devices.name, tc_devices.lastupdate as hora_fecha, " +
"tc_positions.speed as velocidad, tc_positions.latitude, " +
"tc_positions.longitude, tc_positions.devicetime " +
"from tc_users, tc_devices,tc_positions where tc_users.id =tc_devices.userid " +
"and tc_devices.id= tc_positions.deviceid " +
"and tc_positions.devicetime=(select max(devicetime) " +
"from tc_positions where tc_positions.deviceid = tc_devices.id) and tc_users.id= ?1 ",
nativeQuery = true)
List<resumen_entity> resu(Integer userid);

SOAP request stopped to provide PidLidGlobalObjectId and PidLidCleanGlobalObjectId?

I developed an Outlook addin which relies on GlobalObjectId to uniquely identify an event in the calendar. But suddenly the SOAP request I was using to the Exchange server stopped providing the GlobalObjectId and CleanGlobalObjectId.
I was using this request and it worked fine
function generateCalendarUidSoapRequest (itemId) {
const request = '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">' +
' <soap:Header><t:RequestServerVersion Version="Exchange2013" /></soap:Header>' +
' <soap:Body>' +
' <m:GetItem>' +
' <m:ItemShape>' +
' <t:BaseShape>AllProperties</t:BaseShape>' +
' </m:ItemShape >' +
' <t:AdditionalProperties>' +
' <t:FieldURI FieldURI="calendar:UID"/>' +
' <t:ExtendedFieldURI DistinguishedPropertySetId="Meeting" PropertyId="3" PropertyType="Binary" />' +
' <t:ExtendedFieldURI DistinguishedPropertySetId="Meeting" PropertyId="35" PropertyType="Binary" />' +
' </t:AdditionalProperties>' +
' <m:ItemIds>' +
' <t:ItemId Id="' + itemId + '" />' +
' </m:ItemIds>' +
' </m:GetItem>' +
' </soap:Body>' +
'</soap:Envelope>'
return request
}
The response gives no error but now it does not include any <t:GlobalObjectId> nor anything similar. Perhaps an update in the Exchange server? What can I do to fetch the GlobalObjectId or the CleanGlobalObjectId?
I have no problem when requesting these two properties using the following:
<t:AdditionalProperties>
<t:ExtendedFieldURI PropertyType="Binary" PropertyId="3" PropertySetId="6ed8da90-450b-101b-98da-00aa003f1305"/>
<t:ExtendedFieldURI PropertyType="Binary" PropertyId="35" PropertySetId="6ed8da90-450b-101b-98da-00aa003f1305"/>
</t:AdditionalProperties>

How can I call multiple values from the element with the same name with xpath?

I want the last two <dd> elements so that the output will read, Talstrasse 2A 01816 Berggiesshübel
here is the html snippet
<dt>Öffnungszeiten:</dt>
<dd>10:00 - 17:00</dd> <dt>Veranstaltungsart:</dt>
<dd> Herbstmarkt</dd> <dt>Veranstaltungsort:</dt>
<dd> Besucherbergwerk "Marie Louise Stolln" Berggiesshübel</dd> <dt>Strasse:</dt>
<dd>Talstrasse 2A,</dd>
<dt>PLZ / Ort:</dt>
<dd> 01816 Berggiesshübel </dd>
here is the suggested xpath my software gives me.
//div[contains(concat (" ", normalize-space(#class), " "), " container ")]/section[contains(concat (" ", normalize-space(#class), " "), " row event-details ")]/div[1]/div[3][contains(concat (" ", normalize-space(#class), " "), " bg-normal pal mbm ")]/div[1][contains(concat (" ", normalize-space(#class), " "), " row ")]/div[1]/dl[1][contains(concat (" ", normalize-space(#class), " "), " dl-horizontal event-detail-dl ")]/dd[6] | //html/body/div/section/div[1]/div[3]/div[1]/div[1]/dl[1]/dd[6]
can anyone help me?
The last two dd elements would be (//dd)[position() >= last() - 1]. In XPath 2.0 and higher you can get a single string using the string-join function e.g. string-join((//dd)[position() >= last() - 1], ' ').

How to ignore SQL Query part of WHERE conditionally in JPA Query

I am wondering if it is possible to ignore part of query (not whole where part) conditionally. I have query in JPA
#Query("SELECT DISTINCT new it.akademija.wizards.models.document.DocumentGetReviewCommand(" +
"d.author.firstname, d.author.lastname, d.id, d.title, d.description, d.documentType.title, d.submissionDate)" +
" FROM Document d" +
" JOIN d.documentType dt" +
" JOIN dt.reviewUserGroups rug" +
" JOIN rug.users u WHERE u.username = :username" +
" AND d.documentState = it.akademija.wizards.enums.DocumentState.SUBMITTED" +
" AND u <> d.author" +
" **AND (lower(CONCAT(d.author.firstname, ' ', d.author.lastname)) like %:searchFor% " +
" OR lower(d.title) like %:searchFor%" +
" OR lower(d.description) like %:searchFor%" +
" OR lower(d.id) like %:searchFor%" +
" OR lower(dt.title) like %:searchFor%)")
Page<DocumentGetReviewCommand> getDocumentsForReview(#Param(value = "username") String username,
#Param(value = "searchFor") String searchFor,
Pageable pageable);
How can I ignore below part if searchFor param is null or blank ("")
AND (lower(CONCAT(d.author.firstname, ' ', d.author.lastname)) like %:searchFor% " +
" OR lower(d.title) like %:searchFor%" +
" OR lower(d.description) like %:searchFor%" +
" OR lower(d.id) like %:searchFor%" +
" OR lower(dt.title) like %:searchFor%)
You could just try adding logic which allows these conditions to be skipped should the search for term be null or empty:
AND
(COALESCE(:searchFor, '') = '' OR
(LOWER(CONCAT(d.author.firstname, ' ', d.author.lastname)) LIKE %:searchFor% OR
LOWER(d.title) LIKE %:searchFor%" OR
LOWER(d.description) LIKE %:searchFor% OR
LOWER(d.id) LIKE %:searchFor% OR
LOWER(dt.title) like %:searchFor%))

Carrying an ID with strings to a next page

I'm trying to carry the ID to the next page, but all i manage to get is review.php?ID= without the ID.
Here is the code:
html = html + "Name:" + name + "Type : " + type + "Location : " + location + '<input type="button" value="Write a review!" onclick=parent.location="review.php?ID=" ('+ ID +') />' + "<br/>";
Thanks in advance for any help.
There's a couple things wrong here. You have mismatched quotes (single and double), and I'm pretty sure the id shouldnt have spaces round it with parens. The embeded quotes need to be escaped, too
something like this:
html = html + "Name:" + name + "Type : " + type + "Location : " + location +
"<input type='button' value='Write a review!' onclick='parent.location=\"review.php?ID=("+ID+")\" />" + "<br/>";

Resources