Moderator
|
|
Moderator
|
Dear kexian,
Fields can be combined in reports using javascript at least in Kexi 2.4 or newer. Assuming you have persons table with name and surname fields that you want combine: please insert Field report element onto your report, set data source to a table, set the field's Data Source property to:
In the Data View it will combine the field values with space between. I prepared a sample database for you doing exactly that: http://kexi-project.org/pics/2.5/Report_fields.kexi. Here's the result: And the data on the report: Please note that the solution may be changed in the future to something even more handy, however we want to maintain backward compatibility. |
Registered Member
|
Thank you for the information.
That solved my problem. Can it do multiple lines in one field? What else can one do with javascript and Kexi? Is it in the documentation? Kexian |
Moderator
|
If your value, e.g. in column "name" contains end-of-line characters, it will be displayed in multiple lines in your report's Field element. Similarly, if you set Word Wrap to Yes in the Property Editor for your Field element, multiple lines will be used if needed. Make sure height of the Field element is large enough. Another case, you can set Data Source of the Field element to: =field.value("name")+"\n"+field.value("surname"). Note the \n. It will print name and surname in separate rows.
With regular scripts you can handle database operations, opening objects. In reports you can do special things. For example please take a look at excellent tutorial "Drilling Down on Facebook Data" at http://userbase.kde.org/Kexi/Tutorials. Feel free to ask report maintainer Adam Pigg to get more explanations. There is also "Data importing using Javascript" sample database at http://kde-files.org/content/show.php?content=129683. Scripting is experimental at the moment though, it supports multiple languages, what we found costly in terms of development. We're planning to focus on one language, so in result scripting will be reworked. For more info on how to discover scripting capabilities, please see: http://community.kde.org/Kexi/Plugins/S ... umentation. |
Registered users: Bing [Bot], gfielding, Google [Bot], markhm, sethaaaa, Sogou [Bot], Yahoo [Bot]