Announcement

Collapse

NextGen (Mirth) Connect 3.10.0 Released!

NextGen (Mirth) Connect 3.10.0 is now available as an appliance update and on our GitHub page. This release includes better SQL Server database support, security improvements through fixes and library updates, and improvements for the Advanced Clustering plugin with a focus on improving performance of many of the tasks that are carried out on a frequent interval. See the release notes for the list of fixes and updates.

Download | See What's New | Upgrade Guide | Release Notes

For discussion on this release, see this thread.
See more
See less

Multiple row request jdbc to one PDF

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • p.ostheimer
    replied
    still a error

    i search from 2 hours and still found

    i am in revision 61 start from scratch :-)



    [2020-09-24 12:28:29,979] ERROR (com.mirth.connect.connectors.jdbc.DatabaseReceive rScript:123): An error occurred while polling for messages, retrying after 10000 ms...
    com.mirth.connect.connectors.jdbc.DatabaseReceiver Exception: Unrecognized value returned from script in channel "AGENDA PDF", expected ResultSet or List<Map<String, Object>>: [email protected]
    at com.mirth.connect.connectors.jdbc.DatabaseReceiver Script.poll(DatabaseReceiverScript.java:119)
    at com.mirth.connect.connectors.jdbc.DatabaseReceiver .poll(DatabaseReceiver.java:134)
    at com.mirth.connect.donkey.server.channel.PollConnec torJob.execute(PollConnectorJob.java:49)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:2 13)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run (SimpleThreadPool.java:557)


    my source

    var dbConn;
    var result;
    var entryList = java.util.ArrayList();
    var x = '';

    try {
    dbConn = DatabaseConnectionFactory.createDatabaseConnection ('com.intersys.jdbc.CacheDriver','jdbc:Cache://xx.xx.xx.xx:1972/XSTAT','xxxxxxxxx','xxxxxxxx');
    result = dbConn.executeCachedQuery("SELECT agenda->name AS NomAgenda,patient->Nom AS NomPatient,patient->prenom As PrenomPatient, contactType,xStat.Patient.patient_telephone1 as telephone1,xStat.Patient.patient_telephone2 as telephone2,dStart AS DateRDV,dEnd As DateFinRDV,duration,planStatus As Statut, agenda->unit->name As Service FROM xStat_Raw_bAgenda.Entry INNER JOIN xStat.Patient ON xStat_Raw_bAgenda.Entry.patient = xStat.Patient.ID where dStart>=DATE(NOW()) and dEnd<=DATE(current_date+'2 days') and ((planStatus = 'P') OR (planStatus = 'F')) and agenda->unit->name='Radiologie' order by Nomagenda , dStart ASC")


    while (result.next()) {
    var entry = result.getString(1) + "//" + result.getString(2);
    x += "<div>" + entry + "</div>";
    }
    } finally {
    if (dbConn) {
    dbConn.close();
    }
    }



    destination temporaly

    <html>
    <head/>
    <body>

    x

    </body>
    </html>

    Leave a comment:


  • p.ostheimer
    replied
    this seems work , i have a little error in my sql query so i test tomorow

    thanks

    Leave a comment:


  • Thoughts_Shared
    replied
    Modified your existing code a little:

    var dbConn;
    var result;
    var entryList = java.util.ArrayList();
    var x = '';

    try {
    dbConn = DatabaseConnectionFactory.createDatabaseConnection ('com.intersys.jdbc.CacheDriver','jdbc:Cache://xxxxxxxx:xxx/xxxx','login','password');
    result = dbConn.executeCachedQuery("your code")
    while (result.next()) {
    var entry = result.getString(1) + "//" + result.getString(2);
    x += "<div>" + entry + "</div>";
    } finally {
    if (dbConn) {
    dbConn.close();
    }
    }

    <html>
    <head/>
    <body>

    x

    </body>
    </html>

    You might have to finetune it a bit but it should work
    Last edited by Thoughts_Shared; 09-23-2020, 04:31 AM.

    Leave a comment:


  • p.ostheimer
    replied
    thanks for you help

    i have make some research , but nothing work

    i have this in source

    var dbConn;
    var result;
    var entryList = java.util.ArrayList();

    try {
    dbConn = DatabaseConnectionFactory.createDatabaseConnection ('com.intersys.jdbc.CacheDriver','jdbc:Cache://xxxxxxxx:xxx/xxxx','login','password');
    result = dbConn.executeCachedQuery("select bae.agenda->unit->libel1 as service,bae.agenda->name as médecin_agenda,coalesce(p.lastName || ' ' || p.firstName) as prestName,bae.dStart,bae.dEnd, bae.duration,bae.status->libel1 as statut_du_rdv,xp.lastname as nom_patient ,xp.firstname as prénom_patient,xp.NISS,xp.patient_telephone1 as telephone1_patient,xp.patient_telephone2 as telephone2_patientfrom xStat_Raw_bAgenda.Entry baeinner join xStat.Patient xp on xp.rrn = bae.Patient left join xStat_Raw_bAgenda.EntryResource erp on erp.entry = bae.ID and erp.type ='Provider'left join xStat_Raw_bAgenda.Provider p on p.ID=erp.resource where DATE(bae.dStart) between DATE(NOW()) AND DATE(NOW())+30order by bae.agenda->unit->libel1, bae.agenda->name, bae.dStart")


    while (result.next()) {
    var entry = result.getString(1) + "//" + result.getString(2);
    list.add(entry);
    }
    } finally {
    if (dbConn) {
    dbConn.close();
    }
    }


    and i want output a pdf i have this


    <html>
    <head/>
    <body>
    #foreach ($entry in ${entryList})
    <div>
    $entry
    </div>
    #end
    </body>
    </html>

    Leave a comment:


  • pacmano
    replied
    You aren’t providing enough detail. Post screenshots, more code, the actual channel.

    Detail your requirements in plain terms perhaps with sample data and the expected output.

    Leave a comment:


  • p.ostheimer
    replied
    when you aggregate the result some of variable does not work

    example : the name of the file.pdf is a variable ${service} for each ${service} i need a different file

    here whent the aggregate mode is on , i have only 1 file with no_name .pdf

    Leave a comment:


  • agermano
    replied
    Database Reader also has an aggregate mode to return the whole resultset as a single message since mirth 3.5.

    Leave a comment:


  • pacmano
    replied
    Because your database reader returns one row at a time. So effectively you are probably overwriting the same PDF again and again. Change your file writer to use the message id in its name and you will see what is happening.

    I would normally return an array of results for the data you need to put in the PDF in the database reader (e.g. return your select as JSON or XML), and then iterate over that single message that contains all values in the array.


    Leave a comment:


  • p.ostheimer
    started a topic Multiple row request jdbc to one PDF

    Multiple row request jdbc to one PDF

    Hello everyone ,

    i have a stupid question ...

    I have a channel with a source jdbc intersys , i have my request , and on destination a file writer pdf

    the problem is simple , the pdf contains only the last request

    i have read on this forum the #foreach , but i have made many test and no result ...

    My destination template is like

    <html>
    <body>
    <table border="1" width="450">
    <tbody>
    <td>${ma_variable}</td>
    </tbody>
    </html>


    are you a idea ?



Working...
X