How to pass a field that is an array list in a java bean, within a JasperReports? - arraylist

Could some indicate a working example or a snippet of code for JasperReports regarding ArrayList as a Field in a javabean datasource.
I have a List of Employees. Each Employee has a name field, and an array of Phone with type and number as its fields.
Do i use a subreport for Phones I have not found a working example? Cant seem to compile subreport_jasper file?
Do i use a list component instead...
<c:list ...>
<datasetRun subDataset="Addresses">
<datasetParameter name="Phone">
<datasetParameterExpression><![CDATA[$F{Phone}]]></datasetParameterExpression>
</datasetParameter>
</datasetRun>
This does seems to work either?
Thank in advance

I wrote this article while working with MongoDB. It deals with handling fields that are collections. It should be exactly what you need. (You can just ignore the MongoDB part.)
The key idea is that you use this to pass data to a List or Table or Subreport:
new net.sf.jasperreports.engine.data.JRMapCollectionDataSource($F{PhoneArray})

Related

How can we make an Item in socialengine?

I know how to get an item of the particular table. Like for user we can have
$userItem = Engine_Api::_()->getItem("user", $userId);
or for a custom table
$customItem = Engine_Api::_()->getItem("custom", $customeId);
I want to know the code or method how can I make my $customItem to work the same way as $userItem works for users table. So that I can get data or manipulate the data of custom table
Thanks for your help. :-)
You can achieve that by creating a model. Check how it's done in /application/modules/User/Model. There is User.php file that declares User_Model_User and methods available for User such as getTitle, get Href etc.
You may use similar approach for your custom item. You will also need to create a file similar to /application/modules/User/Model/DbTable/User.php to declare table for your custom items.

#Dblookup and formatting on web

I have been developing a web application using domino, therein I have dblookup-ing the field from notes client; Now, this is working fine but the format of value is missing while using on web.
For example in lotus notes client the field value format is as above
I am one, I am two, I am one , I am two, labbblallalalalalalalalalalalalalalalalalalaallllal
Labbbaalalalallalalalalalaalallaal
Hello there, labblalalallalalalllaalalalalalalalalalalalalalalalalalalalalalalala
Now when I retrieve the value of the field on web it seems it takes 2 immediate after 1. and so forth, I was expecting line feed here which is not happening.
The field above is multi valued field. Also on web I have used computed text which does db lookup from notes client.
Please help me what else could/alternate solution for this case.
Thanks
HD
Your multi-valued field has display options associated with it and the Notes client honors those. Obviously, your options are set up to display entries separated by newlines.
The computed text that you are using for the web does not have options like that and the field options are irrelevant because you aren't displaying the field. Your code has to insert the #Newlines. That's pretty easy because #DbLookup returns a list, and if you concatenate a list and a scalar, the scalar will be appended to each element of the list. (Look at the third example under "concatenation, pairwise" here to see what I mean.
The way you've worded your question is a little unclear to me, but what you need in your computed text formula is either something like this:
list := #DbLookup(etc,. etc.);
list + #Newline;
Or something like this:
multiValueFieldContainingListWithDbLookupResult + #NewLine;
I used #implode(Dblookupreturnedvalue;"");
thanks All :)

YouTrack rest api - Get fields metadata

I want to create issues with the youtrack rest api,
Currently I'm using:
PUT /rest/issue?{project}&{summary}&{description}&{attachments}&{permittedGroup}
but I want to set other fields (priority, type, subsystem...)
How do I get a list of available fields from the api? and the fields metadata(is mandatory, field type...)?
And after that, How do I set the value of these fields?
I found this in the docs:
https://confluence.jetbrains.com/display/YTD6/Apply+Command+to+an+Issue
but it looks too complex for setting a field.
Issue can be created with following method and fields set only https://confluence.jetbrains.com/display/YTD6/Create+New+Issue . So as you mentioned, it's
PUT /rest/issue?{project}&{summary}&{description}&{attachments}&{permittedGroup}
It's assumed, other fields can be updated within next call. ApplyCommand (https://confluence.jetbrains.com/display/YTD6/Apply+Command+to+an+Issue)method is pretty good example of such a method.
If you need to know all available fields in the projects, here is the method https://confluence.jetbrains.com/display/YTD6/GET+Project+Custom+Fields.
Meta can be called with the following https://confluence.jetbrains.com/display/YTD6/GET+Project+Custom+Field. As you can see, details are available on per field basis.

Grails trouble saving object id

id is present in the params but does not save to the db. for example
[book.id:1, comments: good]
comments will save to db but book.id does not.
I need to figure out how to save params.book.id into the db column BOOK_ID that was created from the hasmany/belongsTo relationship.
By default value attribute of each element will be the result of a toString() call on each element. Setting it as optionKey allows the value to be a bean property of each element in the list.
Kindly change the select to
<g:form action="review">
<g:select name="book.id"
from="${item.Book.list()}"
value="${book?.id}"
/>
<g:textField name="bookreview" value="${params?.bookreview}" /><br>
kindly refer the below link
Grail example with optionkey
You have overwritten toString, therefore your books are always rendered by name and not id. If you remove your toString() method you will see the expected results.
If you want your select box work with the name, just add optionValue="name".
Well, it seems that I had misspelled a crucial parameter inside my domain. So the domain was expecting x and it was getting y. Thus the id was always null. It took me a while to spot it, and I was perplexed because I had previously successfully implemented ids in another project. Grails has some jira issues also that make one consider other possibilities, but this time it was my mistake.

How to assign unique id attribute to each table row of a CGridView?

I am attempting to assign a unique id to each table row in Yii's CGridView.
Preferably something like $data->id from the database table.
I have been unsuccessful at adding an id attribute to each rendered <tr>.
Any suggestions would be most appreciated.
CGridView have an option called 'rowHtmlOptionsExpression' , you can declare like the followings to assign row an id
'rowHtmlOptionsExpression' => 'array("id"=>$data->id)',
It's better than hacking into 'rowCssClassExpression'
Good luck !
Modern solution (since Yii 1.1.13)
This is now possible to do using the rowHtmlOptionsExpression attribute, which allows assigning arbitrary HTML attributes to each rendered table row. For example:
'rowHtmlOptionsExpression' => '["id" => $data->id]'
Original answer (earlier versions)
Not directly possible because CGridView does not support it, but there are a couple of straightforward solutions that you can try.
Subclass CGridView (good)
Simply create your own class MyGridView extends CGridView and override the renderTableRow method to spit out ids on every row. Have a look at the stock implementation, which does for the class attribute exactly what you 'd like to do for the id attribute.
Use a CSS class instead (not so good)
Speaking of class attributes, the rowCssClassExpression property can be used to dynamically generate classes out of the box. IMHO this is a bad workaround, but it's there.
You could extend CGridView to add that functionality.
or be a bit hacky with rowCssClassExpression.
'rowCssClassExpression' => '\'" data-id="\' . $data->rowID'
Try the information I posted here:
How to set key value in CGrideView when grid is populated from table-view
In essence, as long as your dataprovider to the CGridview provides the data->id in a form that it understands, it will auto handle the $data->id stuff for you automatically so that it's easily available to javascript.
CGridView.rowHtmlOptionsExpression is undefined
I don't think that we can use rowHtmlOptionsExpression