I am printing the results of eSearch done on a layer called "Final Plots" on a custom layout format in PDF. The legend prints the title as "Search Results for Final Plot" followed by Override 1. Is there any way I can do away with these two? The Override 1, I understand is a known Esri Bug which may have been solved at 6.1.
Found a very curious solution to this problem. I was adding the search result as operational layer in eSearch. For trial’s sake, decided against, and it worked!!! I am neither getting “Search Results: Final Plot” as a title in legend and even Override 1 has disappeared.
(the background.. I had eSearch open at startup initially. But I was requested to have users use the Esri WAB Search so as to be simpler. So it is still there but not open by default. In the long term I'm looking at ways of making the Esri Search widget auto complete and zoom to an address. I'm still working on making it go automatically. It works , but if used in conjunction with auto-complete does not click the correct parcel. (from your code here & here.) I had to disable auto complete on our locators because of the 'ghost address' bug that does not appear will be fixed anytime soon. This is the next revision of the site I am working on, without autocomplete and the Esri locator removed, as Suggest can't be disabled on the Esri locator service, until they implement that as an option. For 1.1 or thereafter I hope to add locating and feature popup back but for now it will require the user clicking the result, due to the auto-complete bug.)
Similarly, I wanted to have URL search parameters with eSearch available for some scenarios, but I didn't want to open the widget on the initial app load. Our preference was to have the Layer List or no widget at all display initially. My solution was to use the URL parameter that loads the app with an alternate config, which would be setup to load eSearch at start. Here's how it would look:
I am having an issue performing queries with the Enhanced Search Widget version 2.9. Normally, the widget does not apply blank search boxes towards the query. However, I have found this only applies when the field being searched is a string. If the field being searched is an integer, a NULL value is applied instead of the search box being ignored. This returns results matching conditions where that value is NULL instead of returning results with no search conditions as intended.
Example 1:
I have Street Name as a String (Upper(Street_Name) LIKE Upper('%[value]%')). If the box is left blank, all streets will be returned as results because I have not specified any search conditions.
Example 2:
I have a SegmentID as an Integer (SegmentID = [value]). If the SegmentID box is left blank, all streets with a missing / NULL SegmentID will be returned, rather than just ignoring the SegmentID box instead. Streets with a valid SegmentID are excluded because the query is looking for NULL values. If the records table has no NULL values, then no records are returned, as none of them would match the search conditions.
In the Widget.js find the buildWhereClause method and this line:
}elseif(content[s].value.toString().toLowerCase()==="null"|| content[s].value.toString().toLowerCase()==="nan"){
//Change in 2.9 to see if we can allow null values back in the the unique dropdown//console.info(content.value.toString().toLowerCase());//if (content.isValueRequired === true){var mExpr2 = queryExpr.substr(0, queryExpr.indexOf("="))+"is null";
expr =this.AppendTo(expr, mExpr2, tOperator);//}}else{//don't add the expression if there is no user inputif(eVal !==""){
criteriaFromValue = queryExpr.replace(myPattern, eVal);
expr =this.AppendTo(expr, criteriaFromValue, tOperator);}
and change it to:
}elseif(content[s].value.toString().toLowerCase()==="null"){//|| content.value.toString().toLowerCase() === "nan"//Change in 2.9 to see if we can allow null values back in the the unique dropdown//console.info(content.value.toString().toLowerCase());//if (content.isValueRequired === true){var mExpr2 = queryExpr.substr(0, queryExpr.indexOf("="))+"is null";
expr =this.AppendTo(expr, mExpr2, tOperator);//}}else{//don't add the expression if there is no user inputif(eVal !==""&& content[s].value.toString().toLowerCase()!=="nan"){
criteriaFromValue = queryExpr.replace(myPattern, eVal);
expr =this.AppendTo(expr, criteriaFromValue, tOperator);}
First, the Enhanced Search Widget is great! I have been using it for a long time now. We have recently changed the way we add in your custom widgets now to our web applications. Before, I would use Web App Builder Developers Edition and host the web apps from our web server. There, I would manually update the custom widget code to meet our needs using notepad++ or another text editor. This worked well. We have now moved to hosting the customized widgets through ArcGIS Portal by adding an Application Extension (AppBuilder) and directing the URL to the manifest.json file. Most of your custom widgets work well. We have ran into an issue with the Enhanced Search Widget though. Now, when building a Web Application through WAB, our default Theme is "foldable". The widget works well under this theme. As soon as the theme is changed, the widget breaks. I also cannot add the widget under a different theme. Any help resolving this issue would be greatly appreciated and again, thanks a lot for all the work you do.
I do not use portal so I will not be able to help much. One thing to consider is that Portals WAB version is always behind in versions so you need to be sure to get the right version of the eSearch widget. See the link below to determine which version of WAB coorispond with your Portal version.
Robert you nailed it! I was using version 2.9 of the widget. Since we have Portal 10.6, I needed version 2.7 of the widget. It now works with any theme. Thanks again!
Is there a way that your latest version of the eSearch widget can set an expression similar to the query widget for "is any of" so that the users can select multiple values?
I was able to manipulate the SQL to add multiple values, instead of just one, using the "In" expression. The user just has to enter the multiple values (comma separated) into the search box and it will search across all values.
"prompt": "CrimeClass in", "textsearchhint": "You can copy and paste 1 or more of these commma seperated values directly into the box and then hit search: Aggravated Assault,All Other Offenses,Arson,Auto Theft,Burglary,DUI,Embezzlement,Fraud,Graffiti,Homicide,Hospital Cases,Investigations,Lost and Found,Minor Disturbances, Miscellaneous,Missing Persons,Narcotics,Offenses Against Family,Other Assaults,Pedestrian Investigation,Rape,Receiving Stolen Property,Robbery,Theft,Truancy,Unfounded,Vandalism,Vehicle Accidents,Vehicle Investigation", "sqltext": "CrimeClass IN ('[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]''[value]')", "operation": "stringOperatorIn"
Thanks Again Robert. always putting out quality work. I do have a question however. I am trying to change the SQL expression within the widget from the default from my data set which is
Upper(PID) = Upper('[value]')
to what i feel is a little better query for our purpose of
PID Like '[Value]%'
the text is un-editable within the in app configuration through WAB. could you possibly point me to where i can change the query/expression. I've been digging through the code and cant seem to find it.
Robert, We have been using this widget for our Parcel Viewer and it seems like we are now having troubles with any queries that use the "Contains" filter. This used to work just fine before but now the widget requires the exact search in the box which is not what we want. For example, in our old app we have with an older version of the Enhanced Search widget, if you typed in "175 Main" it would pull up our County building which is 175 S Main. However, in our new Enhanced Search, when we type "175 Main" in as a Street Address query it does not return any results and will only find it if you have typed it in exactly even though I made sure the query was built using the "Contains" filter. Is there something that needs fixed on my end that might be causing this not to work?
Our public viewer is at this URL: ArcGIS Web Application .. the Search Layer is Parcels and the Search Alias is Street Address
It looks like you need to configure the eSearch in the new version to search each word separately like it did in the old version.
Go to the widgets settings and choose the "Edit General Settings" link at the bottom and check "String search that use contains will search for each word seperately in query". Simple fix.
Excellent widget and my hats off to you for this extremely helpful tool.
I have one question about related tables and how they show up in the popup. When I configure the eSearch to "Use Popup from" the "Web Map" it doesn't show the related tables links at the bottom of the popup. I know I can configure the eSearch popup to show these related records but the department I am developing this solution for much prefers the ability to see a related tables link at the bottom of the popup instead of having to click on the ellipsis and selecting "Show Relates" like you do when using the eSearch popup.
Am I configuring something wrong or is there any way to have the Related Tables link show up on the eSearch popup? Any help would be much appreciated!
Thanks for informing me. I will be releasing a 2.11 version with this fixed today. Also a 2.11 version of eSearch with a minor bug fix and automatic hyperlinking of urls in the attributes.
I am really having a hard time try to re-produce this. In my 2.11 WAB that I developed in I could not reproduce it. So I downloaded 2.11 again and installed in a new folder and downloaded eSearch widget from GeoNet and used that download in my clean WAB 2.11 and still could not produce the error.
';
}
}
}
catch(e){
}
}
}
if (newSub.getAttribute("slang").toLowerCase() != code_l.toLowerCase()) {
if (trLabelsHtml != "") {
var labelSname = "";
if(labelEle[i].querySelector("ul li:nth-child(1)").getAttribute("aria-hidden")){
labelSname = labelEle[i].querySelector("ul li:nth-child(1)").outerHTML;
}
labelEle[i].innerHTML = "";
labelEle[i].innerHTML = labelSname + trLabelsHtml;
}
}
}
}
}
catch(e){
}
}
}
/* V 2.0:3 = Store not translated reply id */
if(lingoRSXML.snapshotLength == 0){
if($scope.falseReplyID == "") {
$scope.falseReplyID = value;
}
}
/* Get translated Body of Replies/Comments */
var lingoRBXML = doc.evaluate(lingoRBExp, doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for(var i=0;i 0) {
var attachDiv = rootElement.querySelector('div.lia-quilt-row-main').querySelector('div.custom-attachments');
if (attachDiv) {
attachDiv = attachDiv.outerHTML;
}
else if(rootElement.querySelector('div.lia-quilt-row-main').querySelectorAll('#attachments').length > 0){
if ("TkbArticlePage" == "BlogArticlePage") {
attachDiv = rootElement.querySelector('div.lia-quilt-row-main .lia-message-body-content').querySelector('#attachments');
if (attachDiv) {
attachDiv = attachDiv.outerHTML;
}
else{
attachDiv = "";
}
}else{
attachDiv = rootElement.querySelector('div.lia-quilt-row-main').querySelector('#attachments').outerHTML;
}
}
else {
attachDiv = "";
}
/* Feedback Div */
var feedbackDiv = "";
var feedbackDivs = rootElement.querySelector('div.lia-quilt-row-main').querySelectorAll('div.lia-panel-feedback-banner-safe');
if (feedbackDivs.length > 0) {
for (var k = 0; k < feedbackDivs.length; k++) {
feedbackDiv = feedbackDiv + feedbackDivs[k].outerHTML;
}
}
}
else {
var attachDiv = rootElement.querySelector('div.lia-message-body-content').querySelector('div.Attachments.preview-attachments');
if (attachDiv) {
attachDiv = attachDiv.outerHTML;
} else {
attachDiv = "";
}
/* Everyone tags links */
if (document.querySelectorAll("div.TagList").length > 0){
var everyoneTagslink = document.querySelector('div.lia-quilt-row-main').querySelector(".MessageTagsTaplet .TagList");
if ((everyoneTagslink != null)||(everyoneTagslink != undefined)){
everyoneTagslink = everyoneTagslink.outerHTML;
}
else{
everyoneTagslink = "";
}
}
/* Feedback Div */
var feedbackDiv = "";
var feedbackDivs = rootElement.querySelector('div.lia-message-body-content').querySelectorAll('div.lia-panel-feedback-banner-safe');
if (feedbackDivs.length > 0) {
for (var m = 0; m < feedbackDivs.length; m++) {
feedbackDiv = feedbackDiv + feedbackDivs[m].outerHTML;
}
}
}
}
} catch (e) {
}
if (body_L == "") {
/* V 2.0:7 Replacing translated video data with source video data */
var newBodyVideoData = newBody.querySelectorAll('div[class*="video-embed"]');
angular.forEach($scope.videoData[value], function (sourceVideoElement, index) {
if (index <= (newBodyVideoData.length - 1)) {
newBodyVideoData[index].outerHTML = sourceVideoElement.outerHTML
}
});
/* V 2.0:7 = Replacing translated image data with source data */
var newBodyImageData = newBody.querySelectorAll('[class*="lia-image"]');
angular.forEach($scope.imageData[value], function (sourceImgElement, index) {
if (index <= (newBodyImageData.length - 1)) {
newBodyImageData[index].outerHTML = sourceImgElement.outerHTML;
}
});
/* V 2.0:7 = Replacing translated pre tag data with source data */
var newBodyPreTagData = newBody.querySelectorAll('pre');
angular.forEach($scope.preTagData[value], function (sourcePreTagElement, index) {
if (index <= (newBodyPreTagData.length - 1)) {
newBodyPreTagData[index].outerHTML = sourcePreTagElement.outerHTML;
}
});
}
var copyBodySubject = false;
if (body_L == "") {
copyBodySubject = true;
body_L = newBody.innerHTML;
}
/* This code is written as part of video fix by iTalent */
/* try{
var iframeHTMLText = body_L;
var searchIframeText = "<IFRAME";
var foundiFrameTag;
if (iframeHTMLText.indexOf(searchIframeText) > -1) {
foundiFrameTag = decodeHTMLEntities(iframeHTMLText);
foundiFrameTag = foundiFrameTag.split('src="')[1];
body_L = foundiFrameTag;
}
}
catch(e){
} */
/* This code is placed to remove the extra meta tag adding in the UI*/
try{
body_L = body_L.replace('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />','');
}
catch(e){
}
/** We should not replace the source content if user profile language and selected target language matches with source language **/
if(showTrContent) {
var compiled = false;
rootElement.querySelectorAll('div.lia-message-body-content')[0].innerHTML = null
if("TkbArticlePage"=="IdeaPage"){
// var customAttachDiv = '';
rootElement.querySelectorAll('div.lia-message-body-content')[0].innerHTML = body_L + feedbackDiv ;
$compile(rootElement.querySelectorAll('div.lia-message-body-content')[0])($scope);
compiled = true;
/* Attach atttach div */
// document.querySelector("div.translation-attachments-"+value).innerHTML = attachDiv;
rootElement.querySelectorAll('div.lia-message-body-content')[0].insertAdjacentHTML('afterend',attachDiv);
if(rootElement.querySelectorAll('div.lia-quilt-idea-message .lia-message-body .lia-attachments-message').length > 1){
rootElement.querySelectorAll('div.lia-quilt-idea-message .lia-message-body .lia-attachments-message')[1].remove();
}
} else {
if("TkbArticlePage"=="TkbArticlePage"){
rootElement.querySelectorAll('div.lia-message-body-content')[0].innerHTML = body_L + feedbackDiv ;
}else{
rootElement.querySelectorAll('div.lia-message-body-content')[0].innerHTML = body_L + feedbackDiv + attachDiv;
compiled = true;
}
}
/* Destroy and recreate OOyala player videos to restore the videos in target languages which is written by iTalent as part of iTrack LILICON-79 */ /* Destroy and recreate OOyala player videos */
try{
// $scope.videoData[value][0].querySelector("div").getAttribute("id");
for(var vidIndex=0; vidIndex<$scope.videoData[value].length; vidIndex++){
if( $scope.videoData[value][vidIndex].querySelector("div") != null){
var containerId = LITHIUM.OOYALA.players[$scope.videoData[value][vidIndex].querySelector("div").getAttribute("id")].containerId;
videoId = LITHIUM.OOYALA.players[$scope.videoData[value][vidIndex].querySelector("div").getAttribute("id")].videoId;
/** Get the Video object */
vid = OO.Player.create(containerId,videoId);
/** Destroy the video **/
vid.destroy();
/** recreate in the same position */
var vid = OO.Player.create(containerId,videoId);
}
}
}
catch(e){
}
try{
for(var vidIndex=0; vidIndex<($scope.videoData[value].length); vidIndex++){
if($scope.videoData[value][vidIndex].querySelector('video-js') != null){
var data_id = $scope.videoData[value][vidIndex].querySelector('video-js').getAttribute('data-video-id');
var data_account = $scope.videoData[value][vidIndex].querySelector('video-js').getAttribute('data-account');
var data_palyer = $scope.videoData[value][vidIndex].querySelector('video-js').getAttribute('data-player');
var div = document.createElement('div');
div.id = "brightcove";
div.class = "brightcove-player";
div.innerHTML =
'(view in my videos)'
var data = div.getElementsByClassName("video-js");
var script = document.createElement('script');
script.src = "https://players.brightcove.net/" + data_account + "/" + data_palyer + "_default/index.min.js";
for(var i=0;i< data.length;i++){
videodata.push(data[i]);
}
}
}
for(var i=0;i< videodata.length;i++){
document.getElementsByClassName('lia-vid-container')[i].innerHTML = videodata[i].outerHTML;
document.body.appendChild(script);
}
}
catch(e){
}
if(!compiled){
/* Re compile html */
$compile(rootElement.querySelectorAll('div.lia-message-body-content')[0])($scope);
}
}
if (code_l.toLowerCase() != newBody.getAttribute("slang").toLowerCase()) {
/* Adding Translation flag */
var tr_obj = $filter('filter')($scope.sourceLangList, function (obj_l) {
return obj_l.code.toLowerCase() === newBody.getAttribute("slang").toLowerCase()
});
if (tr_obj.length > 0) {
tr_text = "Esri may utilize third parties to translate your data and/or imagery to facilitate communication across different languages.".replace(/lilicon-trans-text/g, tr_obj[0].title);
try {
if ($scope.wootMessages[$rootScope.profLang] != undefined) {
tr_text = $scope.wootMessages[$rootScope.profLang].replace(/lilicon-trans-text/g, tr_obj[0].title);
}
} catch (e) {
}
} else {
//tr_text = "This message was translated for your convenience!";
tr_text = "Esri may utilize third parties to translate your data and/or imagery to facilitate communication across different languages.";
}
try {
if (!document.getElementById("tr-msz-" + value)) {
var tr_para = document.createElement("P");
tr_para.setAttribute("id", "tr-msz-" + value);
tr_para.setAttribute("class", "tr-msz");
tr_para.style.textAlign = 'justify';
var tr_fTag = document.createElement("IMG");
tr_fTag.setAttribute("class", "tFlag");
tr_fTag.setAttribute("src", "/html/assets/langTrFlag.PNG");
tr_fTag.style.marginRight = "5px";
tr_fTag.style.height = "14px";
tr_para.appendChild(tr_fTag);
var tr_textNode = document.createTextNode(tr_text);
tr_para.appendChild(tr_textNode);
/* Woot message only for multi source */
if(rootElement.querySelector(".lia-quilt-forum-message")){
rootElement.querySelector(".lia-quilt-forum-message").appendChild(tr_para);
} else if(rootElement.querySelector(".lia-message-view-blog-topic-message")) {
rootElement.querySelector(".lia-message-view-blog-topic-message").appendChild(tr_para);
} else if(rootElement.querySelector(".lia-quilt-blog-reply-message")){
rootElement.querySelector(".lia-quilt-blog-reply-message").appendChild(tr_para);
} else if(rootElement.querySelector(".lia-quilt-tkb-message")){
rootElement.querySelector(".lia-quilt-tkb-message").appendChild(tr_para);
} else if(rootElement.querySelector(".lia-quilt-tkb-reply-message")){
rootElement.querySelector(".lia-quilt-tkb-reply-message").insertBefore(tr_para,rootElement.querySelector(".lia-quilt-row.lia-quilt-row-footer"));
} else if(rootElement.querySelector(".lia-quilt-idea-message")){
rootElement.querySelector(".lia-quilt-idea-message").appendChild(tr_para);
} else if(rootElement.querySelector('.lia-quilt-occasion-message')){
rootElement.querySelector('.lia-quilt-occasion-message').appendChild(tr_para);
}
else {
if (rootElement.querySelectorAll('div.lia-quilt-row-footer').length > 0) {
rootElement.querySelectorAll('div.lia-quilt-row-footer')[0].appendChild(tr_para);
} else {
rootElement.querySelectorAll('div.lia-quilt-column-message-footer')[0].appendChild(tr_para);
}
}
}
} catch (e) {
}
}
} else {
/* Do not display button for same language */
// syncList.remove(value);
var index = $scope.syncList.indexOf(value);
if (index > -1) {
$scope.syncList.splice(index, 1);
}
}
}
}
});
});
/* V 1.1:2 = Reply Sync button for multi source translation */
} catch(e){
console.log(e);
}
};
if((rContent != undefined) && (rContent != "")) {
drawCanvas(decodeURIComponent(rContent));
/** Update variable with selected language code **/
$scope.previousSelCode = code_l;
}
};
/**
* @function manageTranslation
* @description Managess the translation of given language for the thread
* @param {string} langCode - Language Code
* @param {string} tid - Thread ID
*/
$scope.manageTranslation = function (langCode, tid) {
//debugger;
$scope.showTrText = false;
/* V 2.0:5 = actualStatus variable introduced to indicate detailed connector status on UI. This variable holds the actual translation percentage */
$scope.transPercent = "";
$scope.actualStatus = "";
if (tid != "") {
var bulkTranslation = lithiumPlugin.bulkTranslation(langCode, tid);
bulkTranslation.then(function (trContent) {
if(trContent.body != "") {
$scope.showPreview(trContent.body, $scope.mszList, langCode);
if(langCode != "en-US") {
$scope.showTrText = true;
}
}
if((trContent.status != "NA") && trContent.status != null) {
// $scope.transPercent = String(trContent.status);
$scope.actualStatus = String(trContent.status);
} else {
// $rootScope.errorMsg = "Translation is in progress. Please check again a few minutes."
$rootScope.errorMsg = "Translation is in progress. Please retry in a few minutes."
}
$scope.workbench = trContent.wb;
/* V 2.0:4 = Trigger uncalled or delayed callbacks (documnet uploaded/translation completed from lithium).*/
if(trContent.callback == 'true') {
var trCompletCallback = lithiumPlugin.trCompletCallback(langCode, trContent.docID);
trCompletCallback.then(function (callback){
// $rootScope.errorMsg = "Downloading Translated content in " + langCode + " now. Please check again in a few minutes."
$rootScope.errorMsg = "Uploading content to translate. Please check again in a few minutes."
});
} else if (trContent.callback == 'upload') {
var trCompletUpload = lithiumPlugin.trCompletUpload(langCode, trContent.docID);
trCompletUpload.then(function (callback) {
//$rootScope.errorMsg = "Uploading content to translate. Please check again in a few minutes."
$rootScope.errorMsg = "Uploading content to translate. Please check again in a few minutes."
});
} else if ("many" == "one") {
$scope.updateOOS();
} else if("SmartConx" == "SmartConx"){
if ("many" == "many"){
$scope.updateOOS();
}
}else if ((trContent.status != null) && trContent.status.includes("100")) {
/* If everything fine then only check Out of Sync status */
$scope.updateOOS();
} else {
/* If translation perccent is less than 100 then show the percentage on UI */
$scope.transPercent = $scope.actualStatus;
}
});
}
}
/**
* @function selectThisLang
* @description Called on select dropdown.
* @param {string} lang - Language code
*
*/
$scope.selectThisLang = function (lang, anonymousFlag) {
/* 1.4:3 Update Analytics on language selection */
try {
setTimeout(()=>{
lingoThreadLangSelected(lang, '910880');
console.log("Language",lang);
},5000)
} catch (e) {
console.log(e);
}
/** Display Translated content **/
var getTranslation = lithiumPlugin.getTranslation(lang, "910880");
getTranslation.then(function (trContent) {
if (trContent.body != "") {
$scope.showPreview(trContent.body, $scope.mszList, lang);
} else {
//$rootScope.errorMsg = "Translation is in progress. Please check again in a few minutes."
$rootScope.errorMsg = "Translation is in progress. Please retry in a few minutes."
}
});
};
var decodeEntities = (function() {
// this prevents any overhead from creating the object each time
var element = document.createElement('div');
function decodeHTMLEntities (str) {
if(str && typeof str === 'string') {
// strip script/html tags
str = str.replace(/