I wanted to pass two parameters through the URL. One with varchar data type and the other with int. The varchar one includes characters, numbers and - for example: wfsjjhc122-hdggb11-2weeee-yu. When I am passing this through URL via queryString. It gives me an error saying incorrect syntax near wfsjjhc122-
I am currently not using quotes. The query string is like pagname.cfm?id=wfsjjhc122-hdggb11-2weeee-yu&no=123.
Should it be something like pagname.cfm?id='wfsjjhc122-hdggb11-2weeee-yu'&no=123? If so how can I pass inverted commas? Currently when I am trying to do so but browser is automatically adding %27 instead of '.
<td bgcolor="#bgColor#">View</td>
Related
Using a ListView Class-based-view, I am looping over the objects present in the database of a certain model in my HTML template, and, for instance, I can access an object's "body_text" attribute with the following syntax: {{object.body_text}}
What if I wanted to only show the first 20 characters of that "body_text" attribute in my HTML template?
How can I set that?
1st Method
Use the truncatechars filter in your HTML template.Truncates a string if it is longer than the specified number of characters. Truncated strings will end with a translatable ellipsis character (“…”).
{{object.body_text|truncatechars:20}}
Reference:
https://docs.djangoproject.com/en/dev/ref/templates/builtins/?from=olddocs#truncatechars
2nd Method
Use the slice filter in your HTML template.
{{object.body_text|slice:":20"}}
Referernce: https://docs.djangoproject.com/en/dev/ref/templates/builtins/#slice
Found it, eventually.
Use the |slice:":" filter in your HTML template.
For example, if you only want to display the first 10 characters of a given attribute, use:
{{object.body_text|slice:":10"}}
{"id":"mergeresult:68b2a5f3-f22a-40c7-b6d0-728ca3f4ede2:2020-06-25:fd18a85c-a1a8-40ae-859a-465b6b9b13a8","mailMergeId":"1636afe5-d103-45d1-8786-d13022d92e07"}
This is the response I a m getting from api and I want this 1636afe5-d103-45d1-8786-d13022d92e07 in my output variable without quotes and also mergeresult:68b2a5f3-f22a-40c7-b6d0-728ca3f4ede2:2020-06-25:fd18a85c-a1a8-40ae-859a-465b6b9b13a8
so basically I want id and mailMergeId value without quotes so that I can pass it into next api request
This is for your id of type 8-4-4-4-12
[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}
I'm importing data from mysql table using import handler. I have a column msg, of type text. Using regex, I have to save substring in a copy field.
msg: 94eb2c0cb17ef354bb052c57f40c\r\nContent-Type: text/plain; charset=UTF-8\r\nContent-Transfer-Encoding pnr:986|0978325
Expected Solr result:
{
"msg_body": "94eb2c0cb17ef354bb052c57f40c\\r\\nContent-Type: text/plain; charset=UTF-8\\r\\nContent-Transfer-Encoding pnr:986-0978325",
"pnr_number": "pnr:986-0978325"
}
My REGEX:
(pnr|(P|p)[ _.:,!"'-/$](N|n)[ _.:,!"'-/$](R|r))+[ _.:,!"'-/$]+[0-9]{3}[ _.:,!"'-/$]+[0-9]{7}
Please help me out as i'm new to solr
You'll need to define a custom field for pnr_number.
Use a copyField to copy msg_body to pnr_number
In the custom field definition, use
<filter class="solr.PatternCaptureGroupFilterFactory" pattern="regex goes here" preserve_original="false"/>
Since you are using Data Import Handler, you have 3 options:
Use a Regex Transformer in DIH definition.
Use a RegexReplaceProcessorFactory Update Request Processor (in solrconfig.xml).
Use a Regex filter in the analyzer chain
With the first two options, the regex will extract the pattern before the field is actually indexed. In the last option, the stored representation (if you store the field) will contain the original full string, but the indexed (searchable) representation will contain regex match.
I'm using filters to consolidate hits to URLS with different variables , into one URL
so:
example.com/abc/123 - 1 hit
example.com/abc/345 - 1 hit
will aggregate consolidate to:
example.come/abc/ - 2 hits
I'm using the SEARCH and REPLACE filter like this :
Search string : /abc/.*
Replace string : /abc/
When I verify this filter, it says no data would be changed. When I change the config to
Search string : /abc/.*
Replace string : /
It reports a major change. It seems the replace string is not right. I basically want to strip the dynamic portion of the URL by replacing any hit that has a dynamic portion with a URL that only has a static portion.
It should work the way you've indicated, but just in case, here's the setup.
Set the Filter Field to "Request URI", and then in the search field use /abc/.*, and in the replace field use /abc/.
Check with the Real-time report, in the Contents report, and also make sure you are doing this in a test view first so that you don't accidentally apply it to your production data.
I have an old hyperlink field that was never linked to the correct path. The field still has relevance though in that it contains the filename associated with the record. I'm trying to update this field by removing the path and leaving just the filename. Hyperlink functionality is not needed.
I've already converted the field to text and removed the hashes so all that remains is the incomplete filepath string. The paths are all similar in format but vary in foldername\filename.
"FOLDERNAME\FILENAME.tif"
In example: "RESEARCH LAB 22\RESEARCH LAB 22 001.tif"
I have the following query, but it requires replacing the foldername manually.
UPDATE BAT1_Document SET BAT1_Document.HYPERLINK = Replace([Hyperlink],"RESEARCH LAB 22\","");
Replacing "*\" with "" would cover my needs but my understanding is that wildcard characters can't be used in a Replace update query so I am at a loss as to how to implement this.
If there are allways "FOLDERNAME\FILENAME.tif" then try:
UPDATE BAT1_Document SET BAT1_Document.HYPERLINK = mid([Hyperlink],instr(1,[Hyperlink],"\")+1);