How to show the parameters passed to jsreport in the report - jsreport

I send a few input field values as parameters to jsreport to show a report based on the the parameters. How do I show the parameters that are passed in the report that is generated.

You can create helper function
function toJSON(data) {
return JSON.stringify(data);
}
and then the print the whole serialized input data into the report (using handlebars for example)
<span>{{{toJSON this}}}</span>

Related

How to stop a test after finding specific word in jmeter response?

How can we stop a jmeter test after finding a specific word from json response:
{"code":12345,"data":{"mylist":[{"myid":111,"secId":2,"TypeId":1,"name":"one two three" ,"description":"thats the value"}]}
Put your request under the While Controller
Use the following __jexl3() function as the condition:
${__jexl3("${value}" != "thats the value",)}
Add JSON Extractor as the child of the request and configure it as follows:
Names of created variables: value
JSON Path Expressions: $.data.mylist[0].description
That's it, the While Controller will loop until "description" fields becomes thats the value
Demo:

How to get date in a Custom Object from a date field in Archer?

I have tried getting the value with JavaScript functions but getting Invalid date.
Also,
var dat = new Date(String(Archertech.UI.GenericContent.GetInstance().getFieldValue(ScheduledDate,false)));
gives the date from one field only, but there are two date fields.
I wonder where can I get the list of functions like
Archertech.UI.GenericContent.GetInstance().getFieldValue(ScheduledDate,false)
There is a Client Manager frontend API that is available which has many functions that will give you the values from fields in the Application.
To get all the function list :
Add a new Custom Object named "debugger" with the code debugger;
Save that object > Open Application > Add a new / Open a record
Open Browser's Console i.e F12 > Developer Tools > Console
Set Target to frame : Record.aspx
type "$CM." will get you a list of supported functions
Now, to get a date field value, use $CM.getFieldValue(fieldId);
Sourabh, you'd have to call the CM.getFieldValue() function for each date field you want to get the value of. There is no such function to retrieve all date fields at once.
RSA Archer doesn't provide any documentation for client-side functions.

Odoo 8 - Qweb output PDF for HR Evaluation Report

when clicking the Print Survey button (Human Resources - Apraissal - Interview Requests), the standard output is HTML (action_print_survey method). I want to change output to PDF.
I couldn't find on Odoo configuration nor standard structure for Qweb reports the way they do it as the standard stands (template yes, menu no, python wrapper no).
I tried to right a wrapper but it doesn't work.
Any ideas?
Thanks in advance
Gustavo
Report
Every report must be declared by a report action.
For simplicity, a shortcut <report> element is available to define a report, rather than have to set up the action and its surroundings manually. That <report> can take the following attributes:
id :
the generated record's external id
name (mandatory):
only useful as a mnemonic/description of the report when looking for one in a list of some sort
model (mandatory):
the model your report will be about
report_type (mandatory) :
either qweb-pdf for PDF reports or qweb-html for HTML
report_name :
the name of your report (which will be the name of the PDF output)
groups:
Many2many field to the groups allowed to view/use the current report
attachment_use:
if set to True, the report will be stored as an attachment of the record using the name generated by the attachment expression; you can use this if you need your report to be generated only once (for legal reasons, for example)
attachment:
python expression that defines the name of the report; the record is acessible as the variable object
Example :
<report
id="account_invoices"
model="account.invoice"
string="Invoices"
report_type="qweb-pdf"
name="account.report_invoice"
file="account.report_invoice"
attachment_use="True"
attachment="(object.state in ('open','paid')) and
('INV'+(object.number or '').replace('/','')+'.pdf')"
/>
Reference Link : https://www.odoo.com/documentation/8.0/reference/reports.html
#Gustavo
That is not an html report, it's a rendered template in response to the request for print the survey using that button action. That's why you couldn't find any declaration for the report but you could easily do it by changing the method definition of the model survey.survey like:
def action_print_survey(self, cr, uid, ids, context=None):
context = dict(context or {}, active_ids=ids, active_model=self._name)
return {
'type': 'ir.actions.report.xml',
'report_name': 'module.survey_print',
'context': context,
}
Also you need to define the report module.survey_print to use the original template. For that you could see how to do it on:
https://www.odoo.com/fr_FR/forum/help-1/question/how-to-define-a-custom-methods-functions-to-be-used-in-a-qweb-report-how-to-define-and-use-a-report-parser-92244

Dojo dStore Rest dGrid sort parameter

When I fetch from a dStore the URL looks something like this
http://localhost/rest/dojo?department=sales
which works fine. If I then click in the header of the dGrid the sent URL looks like this.
http://localhost/rest/dojo?department=sales&sort(+id)&limit(25)
Shouldn't it send &sort=+id&limit=25? I am using Java and Spring for the backend and it expects the parameters to be formatted this way. Right now I can not receive the extra parameters. Is there a way to get it to send the parameters the way Spring is expecting them?
sort(...) and limit(...) are the default behaviors of dstore/Request (which Rest extends), but these can be customized via sortParam for sort, and useRangeHeaders or rangeStartParam and rangeCountParam for range.
For example, to result in &sort=+id&limit=25 as you requested, you could set up your store as follows:
var store = new Rest({
target: '...',
sortParam: 'sort',
rangeStartParam: 'offset',
rangeCountParam: 'limit'
});
I've additionally assumed above that offset is the GET parameter you'd want to use to indicate what record to start at when requesting ranges. Generally if you're not using range headers (useRangeHeaders defaults to false) and you want to set a count GET parameter, you'll also need to set a start GET parameter.
These properties are listed in the Request Store documentation.

Mule: forward GET request with query parameters as POST request with json body

My app receive GET requests with URL query parameters. I would like to transfer this request to another app as POST request. I want that the query parameters will appear in the POST request inside the body as json.
Input GET url for example: http://localhost:8081/?name=John&age=30&gender=male
Expected POST json payload: {"name":"John", "age":30, "gender":"male"}
I think that I should use 'Data Mapper' for that, yet I failed to do so.
In the 'input' section I define the source to be - Inbound Property - http.query.params and type Map<String,String>.
In the output section I want the type to be json.
I can't debug/print the result of this mapping so I can't see what is the outcome of my definition. Is this the correct definition?
How do I define the parameters from the URL to be inserted into the map and be transformed into json?
No need to use DataMapper for such a simple transformation. Instead use a MEL expression transformer to create a map out of the query parameters, then add an object-to-json-transformer to serialize this map to JSON.
For example, this creates a map with the 'name' query param in it:
<expression-transformer
expression="#[['name':message.inboundProperties.'http.query.params'.name]]" />
Just add all the params.