Sending a report by email as a PDF

(8 posts) (2 voices)
  1. myDBR Team, Key Master

    See documentation how the URL is generated.

    When you pass parameters to a report in URL you can use 'u' and 'p' parameters. 'u'-parameters are user changeable whereas 'p' parameters are protected. The hash will change if you change the 'p' parameters, but remains the same if you change the 'u'-parameters.

    --
    myDBR Team

  2. gigilsu, Blocked

    I understand that but I do not understand how to use them. As you see in the example above I used p parameters and I used the variable reportId, which I'm not sure if that is the correct way to get the reportId. I do not understand how to build the url. I need to do the following using those parameters:

    at the top I would declare url,

    DECLARE url VARCHAR(255);

    then I need to define url....

    url = ...... (this is the part that I do not know how to build using p1, p2, report id and hash)

    then I need to do the following using the defined url

    select 'dbr.mail.attach', 'report.pdf', url;

  3. myDBR Team, Key Master

    Hi,
    do not use the 'p' paramerers as they will be included in the hash, use 'u' parameters instead so you can keep same hash parameter.

    When you create the report, you will see the report ID and the hash value in the URL pointing to the report. 'u'-parameters are the parameters you will pass to the report.

    --
    myDBR Team

  4. gigilsu, Blocked

    Can you please show me an example of how this is done.

    select 'dbr.mail.attach', 'report.pdf', ..........

    please fill in the dots using u1, u2... p1... p2 etc.

  5. myDBR Team, Key Master

    You will only need to concatenate the URL if you have parameters. If you do not have parameters, you will simply use the URL.

    In the example you will include a PDF report which has two parameters, a string and a date where 12 is the ID of the report and e2555b68b1535cdc5e202eba57f33954974c6fa2 is the security hash for the report.

    declare vURL varchar(500);
    
    set vURL = concat(
    'http://myserver.com/mydbr/report.php?',
    'r=12',
    '&u1=', user_id_as_string,
    '&u2=', cast( vDate as char(10)),
    '&h= e2555b68b1535cdc5e202eba57f33954974c6fa2',
    '&export=pdf' ); select 'dbr.mail';
    select 'dbr.mail.attach', 'report.pdf', vURL; select 'person@company.com', 'Person Name', 'Mail subject';

    --
    myDBR Team

  6. gigilsu, Blocked

    Thank you, now could you explain how I get the hash that you hardcoded in the example above? This email gets sent to several users and the hash will be different for each user so I would not be able to hardcode it.

  7. myDBR Team, Key Master

    PDF report URL parameters may be different for different users, but the hash will be same for all users when you pass the parameters using 'u'-parameters.

    --
    myDBR Team


Reply

You must log in to post.