Copy jasper reports from one folder to another in jasper server

0

Hi Jasper Gurus,

In jasper server 5.2,we have created a folder(suppose FOLDER 1) and deployed few reports in that folder with  datasource(suppose DATASOURCE 1) for each reports.

Now we copied all the reports and pasted it in a different folder(suppose FOLDER 2).All the reports of   FOLDER 2 are attached with same datasource(DATASOURCE 1)

which the reports of FOLDER 1  are using.Now if we create another datasource(suppose DATASOURCE 2) and want to attach each reports of FOLDER 2 to connect DATASOURCE 2

instead of DTASOURCE 1 ,we have to manually edit each reports of FOLDER 2 and attach the new datsource i.e DATASOURCE 2.This whole process is very hectic and time consuming too.

 

Is there any simple way so that we can change the datasource easily without editing each reports of FOLDER 2 individually.Please suggest.We need the solution urgently.

saha.nabajyoti's picture
Joined: Aug 16 2013 - 6:10am
Last seen: 3 years 10 months ago

5 Answers:

0

I've had the same problem and I've come up with a less time consuming way but its not much easier, so it really depends on how many reports you need to change the datasource for. What I do when I need to change the datasource for a large number of reports is I'll change the datasource for just one report and then export the folder to .zip (if you don't change one of the datasources it won't be included in the zip and then you can't import the update), then use grep -rl <old_datasource_path> and make sure my regex is good then pipe that into xargs sed -i 's:<old_datsource>:<new_datasource>:g' and then rezip the whole thing back up and then import it back into the server. so those steps again are:

1) make one of the reports in your folder point to your new datasource

2) export your report folder

3) run : 'mkdir test && unzip export.zip -d test && cd test' from your downloads folder

4) then run: 'grep -rl 'old_datasource_name' | xargs sed -i 's:old_datasource_name:new_datasource_name:g'

5) zip -r foo.zip ./*

6) Import foo.zip into my server

srang's picture
206
Joined: Oct 28 2014 - 11:52am
Last seen: 3 years 5 months ago
0

Just put the datasource in the same folder as the report and copy and paste the parent folder.

hozawa's picture
51278
Joined: Apr 24 2010 - 4:31pm
Last seen: 4 months 1 week ago
0
Thanks a lot Srang.I know your method will work but as you know,it is also very hectic process and client will not agree with this solution.Anyway thanks a lot for yourhelp.                                                                                        
saha.nabajyoti's picture
Joined: Aug 16 2013 - 6:10am
Last seen: 3 years 10 months ago
0

Another option you might want to try is use organization/tenant/user attributes to dynamically determine the host of your datasource and have all of your reports point to a single datasource object. To get this to work across organizations would be to have the datasource in a public folder and restrict access to execute/read.

srang's picture
206
Joined: Oct 28 2014 - 11:52am
Last seen: 3 years 5 months ago
0

Hozawa,you have given a wonderful solution ,no doubt...........It worked like a charm........Thanks a lot man.....Cheers .:)

saha.nabajyoti's picture
Joined: Aug 16 2013 - 6:10am
Last seen: 3 years 10 months ago
Feedback
randomness