Announcement

Collapse
No announcement yet.

configurationMap in "database reader settings" SQL box

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

  • configurationMap in "database reader settings" SQL box

    Mirth version is 3.4.2

    configurationMap configured for below key's

    PrimaryDbURL
    PrimaryDbUser
    PrimaryDbPassword
    PrimaryDbSchema

    Channel Source Connector type is "Databse reader"
    Database Reader Settings

    Driver -> Postgressql
    URL -> ${PrimaryDbURL}
    Username > ${PrimaryDbUser}
    Password -> {PrimaryDbPassword}

    SQL -> query is " select item_id from uat.hl7_control_items where status='N' ";

    I am getting error for below query.
    select item_id from ${PrimaryDbSchema}.hl7_control_items where status='N'

    for configurationMap.get('PrimaryDbSchema'); and ${PrimaryDbSchema} mirth is not identifying the schema name.

    Please help me to solve this problem

  • #2
    Could you post a screenshot of your configuration map and an export of your channel?

    -= Jack Haines : Founder/CEO of Healthcare Integrations, LLC
    -= [email protected]
    -= Mirth Connect (Advanced)-certified
    -= Gold member of HL7.org
    -= Available for Mirth Connect channel development and consultation! Schedule a FREE call with me at https://calendly.com/jackhaines

    Comment


    • #3
      ScreenShot

      Hi Jack

      Thanks for considering the query.


      I am attaching the screenshot
      Attached Files

      Comment


      • #4
        Send the screenshot of the configurationmap too please?

        -= Jack Haines : Founder/CEO of Healthcare Integrations, LLC
        -= [email protected]
        -= Mirth Connect (Advanced)-certified
        -= Gold member of HL7.org
        -= Available for Mirth Connect channel development and consultation! Schedule a FREE call with me at https://calendly.com/jackhaines

        Comment


        • #5
          ScreenShot config

          configuration map screen shot attached
          Attached Files

          Comment


          • #6
            The quick and easy way is to use JavaScript (instead of just the SQL query) and use:

            Code:
            var query = "select item_id from "+$('PrimaryDbSchema')+".hl7_control_items where status='N' ";
            Also note the $(' not ${'

            -= Jack Haines : Founder/CEO of Healthcare Integrations, LLC
            -= [email protected]
            -= Mirth Connect (Advanced)-certified
            -= Gold member of HL7.org
            -= Available for Mirth Connect channel development and consultation! Schedule a FREE call with me at https://calendly.com/jackhaines

            Comment


            • #7
              Default configurationMap in "database reader settings" SQL box

              Hi jack,

              In case of JavaScript, how to access the result in source transformation. Channlemap.put is not working in source JavaScript connector type.

              Comment


              • #8
                You are correct, you can't use channelMap.put in the JS source, but the query is used to get the row from the table... It will return the row as XML that you can then manipulate to your liking. From that point forward, you would use transformer like normal.

                -= Jack Haines : Founder/CEO of Healthcare Integrations, LLC
                -= [email protected]
                -= Mirth Connect (Advanced)-certified
                -= Gold member of HL7.org
                -= Available for Mirth Connect channel development and consultation! Schedule a FREE call with me at https://calendly.com/jackhaines

                Comment


                • #9
                  Originally posted by jackwhaines View Post
                  The quick and easy way is to use JavaScript (instead of just the SQL query)
                  This is true.

                  SQL mode doesn't use velocity replacement like many of the other connectors do. SQL mode produces a prepared statement and converts the replacement tokens to parameters.

                  According to this link, you can't pass identifiers (such as the schema) as a parameter to a prepared statement.

                  The jdbc driver does have a property you can set for currentSchema that might work, and the url does use normal Velocity replacement. If you set the schema in your url, I think you can still use SQL mode and change your query to:

                  Code:
                  select item_id from hl7_control_items where status='N'

                  Comment


                  • #10
                    configuration map

                    Thank you jack and Thank you agermano for the valuable responses.

                    I resolved the issue by adding "?currentSchema=uat" in the db url in configuration map

                    Comment

                    Working...
                    X