« Back

GraphRep Error in IF statement

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
GraphRep Error in IF statement
community graphrep documentation
Answer
3/27/14 12:12 PM
Hi,
I'm trying to make a graphical representation which, depending on the value of some attributes, must show a tick or not. The following lines show the code I've written:
 1GRAPHREP sizing:asymmetrical
 2AVAL nombre:"Nombre"
 3AVAL x: set-row:0 set-col:"x" dep:"Posición"
 4AVAL y: set-row:1 set-col:"y" dep:"Posición"
 5AVAL alto: "Alto"
 6AVAL ancho: "Ancho"
 7PEN color:$000000 w:pt
 8FILL color:$bf5f00
 9RECTANGLE x:-9pt y:-15.166669999999996pt h:44.33333pt w:18pt
10PEN color:$000000 w:pt
11FILL color:$000000
12ELLIPSE x:3.67pt y:7.50pt rx:1.67pt ry:2pt
13ATTR "Nombre" y:1.8cm w:c h:c
14IF [color=#ff0000][/color](nombre != "") AND (x > 0) AND (y > 0) AND (alto > 0) and (ancho > 0)
15  PEN color:$d4ffaa w:0pt
16  FILL color:$d4ffaa
17  ELLIPSE x:12.25pt y:-20.75pt rx:9.25pt ry:8.75pt
18  PEN color:$00ff00 w:3pt
19  LINE x1:7.5pt y1:-21pt x2:13pt y2:-14pt
20  PEN color:$00ff00 w:3pt
21  LINE x1:12.5pt y1:-14.5pt x2:16.5pt y2:-26.5pt
22ELSE
23  PEN color:$ffffff w:0pt
24  FILL color:$ffaaaa
25  ELLIPSE x:-12.5pt y:-19.5pt rx:9.5pt ry:8.5pt
26  PEN color:$ff0000 w:3pt
27  LINE x1:-17.5pt y1:-24.5pt x2:-7pt y2:-15pt
28  PEN color:$ff0000 w:3pt
29  LINE x1:-18pt y1:-14.5pt x2:-7pt y2:-24.5pt
30ENDIF

The error is on the boolean expresion (red line). When I try to "print" the graph, the tool shows me the error displayed in the attached image  error_1.png .
If I put only two conditions ( such as (nombre != "") AND (x > 0) ), the tool shows me the displayed in the attached image  error_2.png .

Which is the correct way to write these type of conditions and which is the mistake I'm making?
Attachment

Attachment

Attachments: error_1.png (14.0k), error_2.png (12.6k)

RE: GraphRep Error in IF statement
graphrep if
Answer
12/6/13 9:05 AM as a reply to Anonymous.
Thank you for contacting the ADOxx.ORG Team.
There are two minor changes you have to make in the IF statement:
first: the whole condition, composed of more conditions connected with logical operators (AND, OR, NOT, etc.) should be placed within brackets
second: all logical operators should be written in capitals, as the GraphRep language (LEO language) is case-sensitive.
Below please fing an IF statement that is sintactically correct:
1IF (  (nombre != "") AND (x > 0) AND (y > 0) AND (alto > 0) AND (ancho > 0)  )
2...
3ENDIF