New call-to-action
Results 1 to 8 of 8

Thread: SQL error message: expecting RPAREN, found "LEFT"

  1. #1
    Member
    Real Name
    Lauren Fagerman
    Join Date
    Aug 2010
    Location
    Decatur, AL
    Posts
    20

    Default SQL error message: expecting RPAREN, found "LEFT"

    I am trying to create a grid against a remote Database accessed via AlphaDAO. I want to base it on a SQL Select Statement, but when I insert the SQL statement it gives me the following error: line 82:1: expecting RPAREN, found “LEFT”. I am not sure why it is giving me this error because my whole database was created with no problems using the same statement. Has anybody ever encountered this error message?

  2. #2
    "Certified" Alphaholic
    Real Name
    Frank Bicknell
    Join Date
    Feb 2010
    Location
    39.1915° N, 84.4348° W
    Posts
    2,467

    Default Re: SQL error message: expecting RPAREN, found "LEFT"

    I think if you look at your sql select syntax you will find an error. That's what it was for me.

  3. #3
    "Certified" Alphaholic mmaisterrena's Avatar
    Real Name
    Mauricio Maisterrena
    Join Date
    Nov 2006
    Location
    Torreon, Mexico
    Posts
    1,435

    Default Re: SQL error message: expecting RPAREN, found "LEFT"

    I Second that
    Cheers
    Mauricio


  4. #4
    Member
    Real Name
    john bowen
    Join Date
    Aug 2002
    Posts
    160

    Default Re: SQL error message: expecting RPAREN, found "LEFT"

    What is your SQL query?

  5. #5
    Member
    Real Name
    Lauren Fagerman
    Join Date
    Aug 2010
    Location
    Decatur, AL
    Posts
    20

    Default Re: SQL error message: expecting RPAREN, found "LEFT"

    Sorry for the slow reply. Here is my SQL statement:

    SELECT
    PostFile.TrNum,
    PostFile.Dte AS DOS,
    PostFile.TDate AS DOE,
    PostFile.PtNum AS PatientNumber,
    IdentFil.ChartNum,

    ALLTRIM(IdentFil.LastNam) AS PatientLastName,
    ALLTRIM(IdentFil.FirstNam) AS PatientFirstName,
    IIF(ISNULL(IdentFil.MidInit), ' ', IdentFil.MidInit) AS PatientMI,
    IdentFil.Title1 AS PatientTitle,

    ALLTRIM(
    ALLTRIM(IdentFil.LastNam) + ', ' +
    ALLTRIM(ALLTRIM(IdentFil.FirstNam) + ' ' +
    IIF(ISNULL(IdentFil.MidInit), ' ', IdentFil.MidInit))) AS PatientFullName,

    IdentFil.Address1 AS PatientAddress1,
    IdentFil.Address2 AS PatientAddress2,
    IdentFil.City AS PatientCity,
    IdentFil.State AS PatientState,
    IdentFil.Zip AS PatientZip,
    IdentFil.LastPayDt AS PatientLastPayDate,
    IdentFil.LastPayAmt AS PatientLastPayAmt,

    SUBSTR(IdentFil.HomPhone, 1, 3) + "." +
    SUBSTR(IdentFil.HomPhone, 4, 3) + "." +
    SUBSTR(IdentFil.HomPhone, 7) AS PatientHomePhone,

    LEFT(IdentFil.BusPhone, 3) + "." +
    LEFT(RIGHT(IdentFil.BusPhone, 7), 3) + "." +
    RIGHT(IdentFil.BusPhone, 4) AS PatientWorkPhone,

    DocIdent.Doc AS DocCode,
    DocIdent.Name AS DocLastName,
    DocIdent.FirstName AS DocFirstName,
    DocIdent.MidInit AS DocMI,
    DocIdent.Title AS DocTitle,
    DocIdent.Creds AS DocCreds,
    DocIdent.Address1 AS DocAddress1,
    DocIdent.Address2 AS DocAddress2,
    DocIdent.City AS DocCity,
    DocIdent.State AS DocState,
    DocIdent.Zip AS DocZip,
    DocIdent.Group_Name AS DocGroupName,
    DocIdent.Phone AS DocPhone,
    DocIdent.FAX AS DocFax,

    ALLTRIM(
    IIF(ISNULL(DocIdent.Title), '', ALLTRIM(DocIdent.Title)) + ' ' +
    IIF(ISNULL(DocIdent.FirstName), '', ALLTRIM(DocIdent.FirstName)) + ' ' +
    IIF(ISNULL(DocIdent.MidInit), '', ALLTRIM(DocIdent.MidInit)) + ' ' +
    IIF(ISNULL(DocIdent.Name), '', ALLTRIM(DocIdent.Name)) +
    IIF(ISNULL(DocIdent.Creds), ' ',
    IIF(ALLTRIM(DocIdent.Creds) = '', '', ', ' + ALLTRIM(DocIdent.Creds)))
    ) AS DocFullName,

    Facility.Name AS HospitalName,

    I1.InsNum AS InsNum1,
    IIF(ISNULL(I1.CorpName), '', I1.CorpName) AS Carrier1,
    IIF(ISNULL(I1.Mnem), '', I1.Mnem) AS InsMnem1,

    SUM(IIF(P2.Explan = 'Ins.1', P1.Payment, 0.00)) AS Ins1Amount,
    SUM(IIF(P2.Explan <> 'Ins.1' AND SUBSTR(P2.Explan, 1, 3) = 'Ins', P1.Payment, 0.00)) AS Ins2Amount,
    SUM(IIF(P2.Explan = 'Patnt', P1.Payment, 0.00)) AS PatientAmount,
    SUM(IIF(P2.Explan = 'Other', P1.Payment, 0.00)) AS OtherAmount,
    SUM(IIF(P2.Typ = 'X', P1.Payment, 0.00)) As CreditAmount,

    PostFile.Explan,
    PostFile.Amount AS ChargeAmount,
    PostFile.Applied AS TotalPaid,
    PostFile.Ins1 AS Ins1Balance,
    PostFile.Ins2 AS Ins2Balance,
    PostFile.PtNt AS PatientBalance,
    PostFile.Other AS OtherBalance,
    PostFile.Amount - PostFile.Applied AS ClaimBalance,
    vTotals.tamt

    FROM (((PostFile
    LEFT OUTER JOIN PmtAndChrg AS P1 ON PostFile.TrNum = P1.ChrgNum)
    LEFT OUTER JOIN PostFile AS P2 ON P1.PmtNum = P2.TrNum)
    LEFT JOIN IdentFil ON PostFile.PtNum = IdentFil.PtNum)
    LEFT JOIN DocIdent ON PostFile.Doc = DocIdent.Doc AND DocIdent.Doc <> ''
    LEFT JOIN PatIns AS PI1 ON PostFile.PtNum = PI1.PtNum AND PI1.InsOrder = 1
    LEFT JOIN InsIdent AS I1 ON PI1.InsNum = I1.InsNum
    LEFT JOIN DocIdent AS Facility ON PostFile.Lab_Nbr = Facility.Hsp AND Facility.Typ = 'C'
    left join vtotals on vtotals.ptnum = postfile.ptnum

    WHERE
    PostFile.Typ = 'C'

    ORDER BY PostFile.PtNum, PostFile.Dte
    GROUP BY PostFile.TrNum

  6. #6
    "Certified" Alphaholic
    Real Name
    Frank Bicknell
    Join Date
    Feb 2010
    Location
    39.1915° N, 84.4348° W
    Posts
    2,467

    Default Re: SQL error message: expecting RPAREN, found "LEFT"

    Quote Originally Posted by lfagerman View Post

    SUBSTR(IdentFil.HomPhone, 1, 3) + "." +
    SUBSTR(IdentFil.HomPhone, 4, 3) + "." +
    SUBSTR(IdentFil.HomPhone, 7) AS PatientHomePhone,

    LEFT(IdentFil.BusPhone, 3) + "." +
    LEFT(RIGHT(IdentFil.BusPhone, 7), 3) + "." +
    RIGHT(IdentFil.BusPhone, 4) AS PatientWorkPhone,
    Wow, what a select statement.

    I am not sure of why you are doing this in two different functions. I would think that the first method using substr() function would be the prefered way. It seems as though the error is pointing to the left() function. I would retry the statement without that section of code to pinpoint the error.

  7. #7
    "Certified" Alphaholic mmaisterrena's Avatar
    Real Name
    Mauricio Maisterrena
    Join Date
    Nov 2006
    Location
    Torreon, Mexico
    Posts
    1,435

    Default Re: SQL error message: expecting RPAREN, found "LEFT"

    As far as I know alltrim is not an SQL function is an XBasic Function I think you are mixing things up the statemented should be in SQL language only
    http://www.made2mentor.com/2009/09/w...trim-function/
    Cheers
    Mauricio


  8. #8
    Member
    Real Name
    Jim Coltz
    Join Date
    Oct 2005
    Location
    Western Pennsylvania
    Posts
    600

    Default Re: SQL error message: expecting RPAREN, found "LEFT"

    Mauricio,

    alltrim() is one of Alpha's portable SQL functions. Here's a link to a list http://alphafivewiki.com/Portability+Functions Note the "Not Supported By" column in the link for database specifics.

Similar Threads

  1. "Property Not Found" Error message
    By Citadel in forum Alpha Five Version 10 - Desktop Applications
    Replies: 1
    Last Post: 11-24-2009, 05:29 AM
  2. A4V6-"No file handles left"Error message
    By RALPH WHALEY in forum Alpha Four Version 6 and Prior
    Replies: 6
    Last Post: 11-11-2009, 05:35 AM
  3. Server error 500 "nav not found" when adding navigation
    By xmartens in forum Application Server Version 9 - Web/Browser Applications
    Replies: 2
    Last Post: 10-28-2009, 05:38 PM
  4. Error: "File PSAPI.DLL not found"
    By fcajka in forum Alpha Five Version 8
    Replies: 2
    Last Post: 03-29-2007, 05:31 PM
  5. A5V5 error "Form not found"
    By rigore in forum Alpha Five Version 5
    Replies: 14
    Last Post: 10-27-2002, 03:09 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •