Freemarker Template nested interpolation - nested

In my Freemarker template I am calling a static function sha1Hex from org.apache.commons.codec.digest.DigestUtils.
I am trying to generate hash for a label in an XML documents.
${digestUtil.sha1Hex(doc.names.name)}
The following works : ${digestUtil.sha1Hex("John Deer")} as expected.
How can I use nested interpolation?
Thanks for your time and help.

Related

Add Parameter Values to Query String of get request in ADF

I have a Copy Data task which is obtaining data from an API
The API is a GET call to a method and requires 2 parameters
_token
Symbols
I have defined these as parameters
What is the syntax that allows me to use the values of my parameters as the values that are in the query string? So in the screenshot above Symbols is hard coded, but I want the value to be the value of the parameters
I need a screen solution rather than code please as I am not comfortable with ADF yet and I dont know how to get to the code/ARM views
Paul
Using a feature called string interpolation where expressions are wrapped in #{ ... }
Click on the Base URL field. Add Parameters. Using Concat expression function,
Example:
#{Concat('https://stackoverflow.com/questions/GetRealTimeRates?',linkedService().Symbols,'=',linkedService()._token)}
Add first parameter:
Add second parameter:
Test connection. If you see any error, it would provide a description as to debug further.

SoapUI Groovy script to compare db values against Json response

Hi Guys i am new to API automation in SoapUI. i want to know if it is possible to compare data received from the JDBC step against the Json Response. Currently how i am doing is, defining the xpath for each tag and saving values in variables and comparing them. is there a way to automate this in a generic way without defining xpaths for each element in xmls

json_decode collection in template

I have a collection passed from a controller action and added to the view from a variable which I can iterate through for all of the articles in a blog. Each article has its own JSONB column stored in a PostgreSQL table.
I am wondering how to iterate through each article in the blog while JSON decoding each piece of data stored in that specific JSONB column for neat display on a Twig template page. Does anyone have any idea about how to do this? Would it be done in the Controller action and stored into a variable or in a Twig template itself? Could it be done both ways? If so, I would be interested to see how it could be done both ways!
It is easy for me to figure out how to do so on each individual article show page since one article is selected and you can json_decode that one column from the table in the controller then pass a variable (for this example I will call it decoded).
To print a data attribute in a Twig template I can do something like this:
{{decoded['title']}}
Or this:
{{decoded['body']}}
So, how can you achieve something similar with an entire blog collection on a blog index page as opposed to one specific article from the blog table on a show page?
If I were trying to do the same thing with a typical textbook collection in a Twig template the variable passed by the controller to the view (Twig template) would be accessed and iterated through each column in the table like this:
{% for article in blog %}
{article.title}
{article.body}
{% endfor %}
So...I can access the newly added JSON column now similarly by adding it to a similar loop structure on a Twig template page and calling:
{article.json_data}
...but my problem is that there is no json_decode filter for Twig template variable output, only json_encode which can be called in a similar iteration loop like this:
{article.json_data | json_encode}
...but I need json_decode not json_encode, thus my question!
Thank you for any and all help offered!

Marklogic : "highlight" seem not work withe Node.js and QueryBuilder

I try to get an extract of the text with the searched words highlighted on a JSON collection.
My search syntax is:
qb.word(qb.field('doc_text'),vartxt)
With 'doc_text' declared as field
(field type: root, include root: false, includes: doc_text), in an Node.js application.
The search works well, and it is done well on this field ...
But in txt[0].results[kl].matches[0]['match-text'], I find the first 3 properties of the JSON,
and not an extract from 'doc_text' with the words found.
I have another application in which the highlights work correctly, but it is based on XML.
Did I forget something in the field declaration, or is the operation different between JSON
and XML data, or is the highlight system not running on JSON via Node.js and QueryBuilder ?
Kind regards
Fields do not work quite the same way in XML and JSON. I think you're running into this limitation:
http://docs.marklogic.com/guide/app-dev/json#id_24090
The value of a field in XML can be the concatenation of all the text nodes, but the same does not apply in JSON.
I think I understood !!!
This query gives a correct snippet, with the extract and the words highlighted :
mkcq.and(mkcq.collection('document'), mkcq.word(mkcq.field('doc_text'), 'connaitre'))
On the other hand, this query gives the first 3 fields of the JSON :
mkcq.and(mkcq.collection('document'), mkcq.word(mkcq.field('doc_text'), 'connaitre'), mkcq.value(mkcq.element('','doc_user'), 'mbp'))
I do not know if this is normal or not, but it should be able to be corrected either by a simplified query and a selection on the returned records, evening by a particular snippeter.
Kind regards

How to get one of repeatable text field liferay7 Freemarker

I created a Web content Dsiplay ( Text as a repeatable field in structure ).
In the structure template i wanted to have only the third element.
I tried
${Text.getSiblings()[3].getData()}
But it doesn't work
I am using Liferay-7 and Freemarker as Stucture template
Thank you
Index fields start with 0 so the solution for the 3rd element is :
${Text.getSiblings()[2].getData()}

Resources