I successfully managed to create two custom result types with two custom display templates.
I configured the result types in the way, that if the titel of the result item contains "String 1" it uses *Item_Case1* and if the title contains "String 2" it uses *Item_Case2*.
Now I tried to play around with the priorites.
If the title is "String 1 blablabla String 2" I want it to use "Item_Case1".
A little schematic how I want it to be:
(SearchTerm --> Display Template)
- "String 1 bla bla" --> "Item_Case1"
- "String 2 bla bla" --> "Item_Case2"
- "String 1 blabla String 2" --> "Item_Case1"
According to this site the priority which display template will be used is defined by the standing in the list of result types.
But no matter what I tried, it wouldn't work. The only (ugly) workaround I found was to deactivate the templates by altering the searchTerm from "String 1" to "String 1bla" first and then activate them in the order I needed them.
So, is this a known bug or did I do something wrong?
Related
I want to extend the query result with specific values, but I do not know how to get only a fragment of information, the one that is in the screen, that is, for example, from the "rendereddescription" section, I only need information about "server_principal_name" and assign it to some value, e.g. "user" and this I know this needs to be resolved | extend "variable name" = i here i do not know what the syntax is.enter image description here
you can use the parse operator: https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/parseoperator
for example:
print RenderDescription = #"... 0000000000 session_server_principal_name:ABB\HPAM-TCS-DB10 server_principal_sid:01050000000 ...."
| parse RenderDescription with * "session_server_principal_name:" session_server_principal_name " " *
RenderDescription
session_server_principal_name
... 0000000000 session_server_principal_name:ABB\HPAM-TCS-DB10 server_principal_sid:01050000000 ....
ABB\HPAM-TCS-DB10
I have a struct called ArticlePreview. It contains a title and a description.
Now I want to have a SelectView showing these items, so the user can choose one.
When I use the normal .add_item(label, type) function, the SelectView only displays one line for each Item. It looks like this:
Article 1 title
===============
Article 2 title
===============
Article 3 title
===============
....
(The === is just a separator in-between the items)
But now I want to also show the description of the Article in the SelectView. It should end up looking like this:
Article 1 title
This is the description of Article 1
================
Article 2 title
.....
It would be best, if I could tell the SelectView somehow that it should use the ArticlePreview.title and the ArticlePreview.description when displaying
ColdFusion doesn't preserve the order in which elements were assigned to the structure.
This gives a problem when, in my particular case, I need to create a SOAP envelope from this structure and the receiver needs to data in the envelope in a particular order.
Starting from ColdFusion 2016 and higher, there is a "type" option in the StructNew() method where you can specify "Ordered". Unfortunately, I'm still on CF9.02...
For example (in CF9):
<cfscript>
myStruct=StructNew();
myStruct.one=StructNew();
myStruct.one.item1="Old Trafford";
myStruct.one.item2="Anfield";
myStruct.two=StructNew();
myStruct.two.item3="Stamford Bridge";
myStruct.two.item4="Villa Park";
myStruct.three=StructNew();
myStruct.three.item5="St James Park";
myStruct.three.item6="Emirates Stadium";
WriteDump(myStruct);
</cfscript>
Output:
{"ONE":{"ITEM2":"Anfield","ITEM1":"Old Trafford"},"THREE":{"ITEM6":"Emirates Stadium","ITEM5":"St James Park"},"TWO":{"ITEM4":"Villa Park","ITEM3":"Stamford Bridge"}}
As you can see, the order is scrambled.
A second problem is the UPPERCASE. All the items are transformed to uppercase...
This is a problem for a SOAP envelope, because it is case sensitive.
Order.
The solution is to use a java LinkedHashMap which can be used just like a structure in ColdFusion.
So, I just need to replace
StructNew();
with: createObject("java", "java.util.LinkedHashMap").init();
Uppercase:
Assign/address them though their string name. This will preserve the case.
So, the example becomes:
<cfscript>
myStruct=createObject("java", "java.util.LinkedHashMap").init();
myStruct['one']=createObject("java", "java.util.LinkedHashMap").init();
myStruct['one']['item1']="Old Trafford";
myStruct['one']['item2']="Anfield";
myStruct['two']=createObject("java", "java.util.LinkedHashMap").init();
myStruct['two']['item3']="Stamford Bridge";
myStruct['two']['item4']="Villa Park";
myStruct['three']=createObject("java", "java.util.LinkedHashMap").init();
myStruct['three']['item5']="St James Park";
myStruct['three']['item6']="Emirates Stadium";
WriteDump(SerializeJSON(myStruct));
</cfscript>
Output:
{"one":{"item1":"Old Trafford","item2":"Anfield"},"two":{"item3":"Stamford Bridge","item4":"Villa Park"},"three":{"item5":"St James Park","item6":"Emirates Stadium"}}
Nicely ordered and case preserved!
Adobe ColdFusion (2018 Release). I not sure about earliest versions.
ColdFusion doesn't preserve the order in which elements were assigned to the structure.
Try to use as an array instead. Structures in CF are basically associative arrays, in this case bellow you are using actual key value instead of index.
var yourCollection = [
"one" = ["item1" = "Old Trafford", "item2" = "Anfield"],
"two" = ["item3" = "Stamford Bridge", "item4" = "Villa Park"],
"three" = ["item5" = "St James Park", "item6" = "Emirates Stadium"]
];
A second problem is the UPPERCASE. All the items are transformed to uppercase...
Wrapping keys with quotation marks, output should preserve casing, at least at the current version.
I am trying to send out a mass mail merge email to clients who are in an accreditation process. I am using an Excel spreadsheet in the merger, and in the datasheet if the client has taken a class I indicate it with the number of credit hours (so they can also be added up as part of the letter). However since I want the class name rather than the number of credits it is worth I used the "if...then...else.." field. So that if the credit number is greater than 0 than the Class Name is inserted or else it is blank. My Merge field therefore looks like this:
{ IF { MERGEFIELD M_2713_CLASS } = 6 "Class Name" ""}
Where the "6" is the number of credits. There are about 40 classes entered as a list (one below the other). The problem I am running into is getting the classes that the client has not taken and are therefore blank to not show up as a blank line. I am not a programmer by any meaning of the word but I know there is a way to do it, I just can't seem to figure out even with the help of Google. Any suggestions?
The traditional approach is along the following lines:
{ IF { MERGEFIELD M_2713_CLASS } = 6 "Class Name A
" }{ IF { MERGEFIELD M_2713_CLASS } = 7 "Class Name B
" }{ IF { MERGEFIELD M_2713_CLASS } = 8 "Class Name C
" }etc.
I.e. You press Enter to insert a paragraph mark inside the IF field, at the end of the text you want to insert., instead of outside the IF field.
I have a portion of HTML that looks similar to:
<table><tbody><tr>
<td><div> Text Goes Here </div></td>
<td> ... rest of table
There are no IDs, no Titles, no descriptors of any kind to easily identify the div that contains the text.
When an error occurs on the page, the error is inserted into the location where "Text Goes Here" is at (no text is present unless an error occurs). Each error contains the word "valid".
Examples: "The form must contain a valid name" or "Invalid date range selected"
I currently have the Watir code looking like this:
if browser.frame(:index => 0).text.includes? "valid"
msg = # need to get full text of message
return msg
else
return true
end
Is there any way to get the full text in a situation like this?
Basically: return the full text of the element that contains the text "valid" ?
Using: Watir 2.0.4 , Webdriver 0.4.1
Given the structure you provided, since divs are so often used I would be inclined to look for the table cell using a regular expression as Dave shows in his answer. Unless you have a lot of nested tables, it is more likely to return just the text you want.
Also if 'valid' may appear elsewhere then you might want to provide a slightly larger sample of the text to look for
. browser(:cell => /valid/).text
Try this
return browser.div(:text => /valid/).text
or
return browser.table.div(:text => /valid/).text
if the valid is not found, it should return nil.