How to add an extra row in data set after fetch

cypherdj
edited February 11, 2022 in Analytics #1
Hi there,

Basically, I want to join 2 queries, one containing all users, the other containing tasks per department.

Some tasks may be unassigned, in which case the userid is 0.

I then create a full outer join on the 2 queries, so for the purpose of the unassigned tasks, I'd like to insert a dummy user in the users data set.

Is it possible to insert an extra row after fetch or any other event?

Thanks,
Cedric

Comments

  • mwilliams
    edited December 31, 1969 #2
    Hi Cedric,

    I'm guessing that the easiest solution would probably just be to have a dummy user added to the user database for use with your report. If you aren't able to do that, you should be able to create a java based dataSource that runs an embedded SQL query on your database and then adds the dummy record to the end. So far, I don't see an easier way to do this within BIRT.

    Regards,

    Michael
    Warning No formatter is installed for the format ipb
  • cypherdj
    edited December 31, 1969 #3
    Thanks for the suggestions Michael, but adding the dummy row in the database is not an option, and using java is something I'd be reluctant to do.

    I found another way to get round my problem, by adding the following to my original user query:

    union
    select 0 as userid,
    'Unassigned' as username,
    i as deptid,
    name as deptname
    from department

    This effectively creates the dummy row in the result set for all departments at runtime. Not the most elegant, but does exactly what I want!
  • mwilliams
    edited December 31, 1969 #4
    Cedric,

    Yeah, that's definitely simpler than what I suggested. :) I didn't even think about that. Glad you found something.

    Regards,

    Michael
    Warning No formatter is installed for the format ipb