What am I doing wrong here please?

Public support forum for peer to peer support with related to the Visual Objects and Vulcan.NET products
Post Reply
Anonymous

What am I doing wrong here please?

Post by Anonymous »

Among many "RETURN" warnings I'm getting, I'm also getting this:

METHOD CurrentJob()
LOCAL oReport AS RpReport
LOCAL cJobName,cPrint2Filename,cCaption,cMessage AS STRING
MEMVAR cSearch

SELF:Pointer := Pointer{ POINTERHOURGLASS }
cSearch := SELF:Server:FIELDGET(#CLCode)

oReport := RpReport{ SELF, "Joblist.RPT" }

IF oReport:IsValid

cJobName := "Current Jobs Listing"
cPrint2Filename := "REPORT.PRN"
cCaption := cAppVersion +" : Report Preview"
cMessage := "Printing in progress..."

oReport:FilterExpression := "details.CLcode == cSearch"
oReport:PrintPreview(cJobName,cPrint2Filename,cCaption,cMessage,,SW_SHOWMAXIMIZED)

SELF:Pointer := Pointer{ POINTERARROW }

ENDIF

oReport:Close()
RETURN SELF

The error message is:error XS9002: Parser: unexpected input 'ENDIF' 227,1 Window Addons.prg Business Manager 1
FFF
Posts: 1584
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

What am I doing wrong here please?

Post by FFF »

If your report fails, you are stuck with the hourglass :;, but apart from this I don't see a reason for the error, sorry.
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
User avatar
wriedmann
Posts: 3765
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

What am I doing wrong here please?

Post by wriedmann »

Hello,

IMHO the error stays in the entity before this one.

Please post the entire prg file.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
lumberjack
Posts: 727
Joined: Fri Sep 25, 2015 3:11 pm
Location: South Africa

What am I doing wrong here please?

Post by lumberjack »

BiggyRat wrote:Among many "RETURN" warnings I'm getting, I'm also getting this:

Code: Select all

METHOD CurrentJob() 
LOCAL oReport AS RpReport
LOCAL cJobName,cPrint2Filename,cCaption,cMessage AS STRING
MEMVAR cSearch

SELF:Pointer := Pointer{ POINTERHOURGLASS }
cSearch := SELF:Server:FIELDGET(#CLCode)

oReport := RpReport{ SELF, "Joblist.RPT" }

IF oReport:IsValid

  cJobName 		:= "Current Jobs Listing"
  cPrint2Filename	:= "REPORT.PRN"
  cCaption		:= cAppVersion +" : Report Preview"
  cMessage		:= "Printing in progress..."

  oReport:FilterExpression := "details.CLcode == cSearch"
  oReport:PrintPreview(cJobName,cPrint2Filename,cCaption,cMessage,,SW_SHOWMAXIMIZED)

  SELF:Pointer := Pointer{ POINTERARROW }

ENDIF

oReport:Close() 
RETURN SELF
The error message is:error XS9002: Parser: unexpected input 'ENDIF'
As Karl indicated the code does seem fine. That error is normally associated with:

Code: Select all

IF True
  // IF True
  ENDIF
ENDIF // Error unexpected ENDIF
Just some observations.
  • Why not strict type this method, METHOD CurrentJob() AS VOID|LOGIC
  • MEMVAR cSearch, I would change that to LOCAL

Code: Select all

LOCAL cSearch AS STRING
oReport:FilterExpression := "details.CLcode == #v#":Replace("#v#", cSearch) // This might be a runtime error , is CLcode a C/N field?
  • RETURN SELF // Do you really need to return the object?

    Code: Select all

      RETURN [lSuccess] // Just preference, but a "cleaner" solution
      
    Regards,
______________________
Johan Nel
Boshof, South Africa
User avatar
lumberjack
Posts: 727
Joined: Fri Sep 25, 2015 3:11 pm
Location: South Africa

What am I doing wrong here please?

Post by lumberjack »

Hi Wolfgang,
wriedmann wrote: IMHO the error stays in the entity before this one.
You are correct, I think the problem is in :FilterExpression("details.CLcode == cSearch"), which I tried to "fix" in my example.
Regards,
______________________
Johan Nel
Boshof, South Africa
User avatar
Chris
Posts: 4936
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

What am I doing wrong here please?

Post by Chris »

Most likely it's the "MEMVAR", those are not supported (yet) and this desyncs the parser, reporting an error at a later line. Just convert it to a LOCAL as Johan suggested and the error will go away.

Although I assume you do use that MEMVAR later in filter expressions, so simply turning it them to a LOCAL will not be enough for you. If that's the case, then it is probably a good idea to wait a little bit more, until the X# runtime and compiler does support MEMVARs. Most of the base work has been done already, so it should not take too long.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
lumberjack
Posts: 727
Joined: Fri Sep 25, 2015 3:11 pm
Location: South Africa

What am I doing wrong here please?

Post by lumberjack »

Hi Chris,
Chris wrote: Although I assume you do use that MEMVAR later in filter expressions, so simply turning it them to a LOCAL will not be enough for you. If that's the case, then it is probably a good idea to wait a little bit more, until the X# runtime and compiler does support MEMVARs. Most of the base work has been done already, so it should not take too long.
If he has a "fixed" filter expression it can be overcome with the way I showed:

Code: Select all

oReport:FilterExpression := "details.CLcode == #v#":Replace("#v#", cSearch)
Just have to " 'cSearch' " if a string type.

Regards,
______________________
Johan Nel
Boshof, South Africa
Post Reply