Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

How do you edit Report Layout

Locked
jkdev
Posts: 20
Joined: Fri Aug 01, 2014 2:26 pm

How do you edit Report Layout

Unread post by jkdev »

My question may appear to be primitive, but with all my attempts I have not been able to figure out how to edit a Report Layout built using the Report Builder.

I created a my first test report and the report can be run. PDF generates. Works ok.

But then I want to go back and play with the Report Layout. When I click the Report Builder, previous objects are not shown.

I see the following layout code in table zzzsys_report

Code: Select all

{"top":30,"left":30,"bottom":260,"right":30,"width":210,"height":297,"paper":"A4","orientation":"P","groups":[{"sortField":"Detail","sortBy":"a","sections":[{"id":"","top":110,"height":40,"label":"Detail Header","page_break":0,"margins":6,"color":"#FFFFFF","objects":[{"id":"object1001","group":0,"section":0,"objectType":"field","left":68,"top":3,"height":20,"width":100,"backgroundColor":"white","borderColor":"black","borderWidth":0,"fieldName":"site_siteid","fontColor":"black","fontFamily":"Arial","fontSize":14,"fontWeight":"","format":"","textAlign":"left","image":"","zIndex":100,"minRows":0,"maxRows":0,"selected":0,"name":"object1001"},{"id":"object1002","group":0,"section":0,"objectType":"field","left":182,"top":4,"height":20,"width":100,"backgroundColor":"white","borderColor":"black","borderWidth":0,"fieldName":"site_town","fontColor":"black","fontFamily":"Arial","fontSize":14,"fontWeight":"","format":"","textAlign":"left","image":"","zIndex":101,"minRows":0,"maxRows":0,"selected":1,"toselect":0,"name":"object1002"}]}]},{"sortField":"Report","sortBy":"a","sections":[{"id":"","top":30,"height":40,"label":"Report Header","page_break":0,"margins":2,"color":"#FFFFFF","objects":[]},{"id":"","top":190,"height":40,"label":"Report Footer","page_break":0,"margins":10,"color":"#FFFFFF","objects":[]}]},{"sortField":"Page","sortBy":"a","sections":[{"id":"","top":70,"height":40,"label":"Page Header","page_break":0,"margins":4,"color":"#FFFFFF","objects":[]},{"id":"","top":150,"height":40,"label":"Page Footer","page_break":0,"margins":8,"color":"#FFFFFF","objects":[]}]},{"sortField":"","sortBy":"a","sections":[{"id":"","top":110,"height":0,"label":" Header","page_break":0,"margins":4,"color":"#FFFFFF","objects":[]},{"id":"","top":150,"height":0,"label":" Footer","page_break":0,"margins":6,"color":"#FFFFFF","objects":[]}]},{"sortField":"","sortBy":"a","sections":[{"id":"","top":110,"height":0,"label":" Header","page_break":0,"margins":4,"color":"#FFFFFF","objects":[]},{"id":"","top":150,"height":0,"label":" Footer","page_break":0,"margins":6,"color":"#FFFFFF","objects":[]}]},{"sortField":"","sortBy":"a","sections":[{"id":"","top":110,"height":0,"label":" Header","page_break":0,"margins":4,"color":"#FFFFFF","objects":[]},{"id":"","top":150,"height":0,"label":" Footer","page_break":0,"margins":6,"color":"#FFFFFF","objects":[]}]},{"sortField":"","sortBy":"a","sections":[{"id":"","top":110,"height":0,"label":" Header","page_break":0,"margins":4,"color":"#FFFFFF","objects":[]},{"id":"","top":150,"height":0,"label":" Footer","page_break":0,"margins":6,"color":"#FFFFFF","objects":[]}]},{"sortField":"","sortBy":"a","sections":[{"id":"","top":110,"height":0,"label":" Header","page_break":0,"margins":4,"color":"#FFFFFF","objects":[]},{"id":"","top":150,"height":0,"label":" Footer","page_break":0,"margins":6,"color":"#FFFFFF","objects":[]}]},{"sortField":"","sortBy":"a","sections":[{"id":"","top":110,"height":0,"label":" Header","page_break":0,"margins":4,"color":"#FFFFFF","objects":[]},{"id":"","top":150,"height":0,"label":" Footer","page_break":0,"margins":6,"color":"#FFFFFF","objects":[]}]},{"sortField":"","sortBy":"a","sections":[{"id":"","top":110,"height":0,"label":" Header","page_break":0,"margins":4,"color":"#FFFFFF","objects":[]},{"id":"","top":150,"height":0,"label":" Footer","page_break":0,"margins":6,"color":"#FFFFFF","objects":[]}]},{"sortField":"","sortBy":"a","sections":[{"id":"","top":110,"height":0,"label":" Header","page_break":0,"margins":4,"color":"#FFFFFF","objects":[]},{"id":"","top":150,"height":0,"label":" Footer","page_break":0,"margins":6,"color":"#FFFFFF","objects":[]}]}],"currentGroup":0}
The objects that I have added are there.

But I do not see them when I click Report Builder button.
jkdev
Posts: 20
Joined: Fri Aug 01, 2014 2:26 pm

Re: How do you edit Report Layout

Unread post by jkdev »

Digging in to code I found this in nureportbuilder.php

Code: Select all

function nuLoadReport(){

    if(window.opener){
        if(String(window.opener.document.getElementById('sre_layout').value) == ''){return;}              //-- nothing to load
    }else{
        return;
    }
    
    var report                                             = $.parseJSON(window.opener.sre_layout.value);
    window.REPORT                                          = new nuREPORT();
    window.REPORT.top                                      = report.top;
    window.REPORT.left                                     = report.left;
    window.REPORT.bottom                                   = report.bottom;
    window.REPORT.right                                    = report.right;
    window.REPORT.width                                    = report.width;
    window.REPORT.height                                   = report.height;
    window.REPORT.paper                                    = report.paper;
    window.REPORT.orientation                              = report.orientation;
    nuChangeWidth(REPORT.width)
Can somebody explain how the sre_layout get passed on to this function?
jkdev
Posts: 20
Joined: Fri Aug 01, 2014 2:26 pm

Re: How do you edit Report Layout

Unread post by jkdev »

After inserting some debug commands I found that the code fails at the following line. The sre_layout field from the database gets correctly passed in to window.opener.document.getElementById('sre_layout').value.

Code: Select all

    var report                                             = $.parseJSON(window.opener.sre_layout.value);
I tried changing it to

Code: Select all

    var report                                             = $.parseJSON(window.opener.getElementById('sre_layout').value);
but no progress.

Can somebody help me to troubleshoot from this point onwards as I am not an expert in Javascript and specially the jquery library?
jkdev
Posts: 20
Joined: Fri Aug 01, 2014 2:26 pm

Re: How do you edit Report Layout

Unread post by jkdev »

Finally I found the problem.

When the string 'sre_layout' os passed in to function parseJSON directly the execution fails.

When you assign the same to a variable and use variable in parseJSON it works.

I added some check to trap errors also.

Code: Select all

try {
    var testdata;
    testdata=window.opener.document.getElementById('sre_layout').value;

    var report = $.parseJSON(testdata);
} catch (e) {
// error
  alert("error! ... in JSON string");
  return;
}

admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: How do you edit Report Layout

Unread post by admin »

jkdev,

I can look at the problem if you can send me your database.

BTW what browser are you using?

Steven
jkdev
Posts: 20
Joined: Fri Aug 01, 2014 2:26 pm

Re: How do you edit Report Layout

Unread post by jkdev »

Thanks Steven.

I used Firefox 18.0.1 on Win 7 and Firefox 10.0.1 on Ubuntu 10.4.

Did not bother to check other browsers once I found a workaround.

I will send you the data base later for your analysis.

I wonder whether the browser's inbuilt JSON library is being used rather than JQuery's which gives these abnormal behavior.
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: How do you edit Report Layout

Unread post by admin »

.
Locked