Recent

Author Topic: Scripts  (Read 22159 times)

adilsonpazzini

  • New Member
  • *
  • Posts: 29
Re: Scripts
« Reply #15 on: August 09, 2018, 04:09:00 pm »
Reading the link http://wiki.freepascal.org/LazReport_Documentation#Script  in part Logical/boolean functions

IF(<X>, <Y>, <Z>)
    Returns < Y > if expression < X > is true. If false, returns < Z >.

I need to do something like this IF(["TABLE".FIELDVALUE1>0,"TABLE".FIELDVALUE,0]) .

Has anyone ever had to do something like this?

Thanks in advance .

Adilson

korba812

  • Sr. Member
  • ****
  • Posts: 391
Re: Scripts
« Reply #16 on: August 09, 2018, 04:39:59 pm »
You should use parentheses:
IF([["TABLE".FIELDVALUE1]>0,["TABLE".FIELDVALUE],0])
(my mistake)

IF(["TABLE".FIELDVALUE1]>0,["TABLE".FIELDVALUE],0)
« Last Edit: August 09, 2018, 04:42:21 pm by korba812 »

adilsonpazzini

  • New Member
  • *
  • Posts: 29
Re: Scripts
« Reply #17 on: August 09, 2018, 06:47:59 pm »
I tried even harder not to. Am I doing something wrong?

Thanks for the feedback .

korba812

  • Sr. Member
  • ****
  • Posts: 391
Re: Scripts
« Reply #18 on: August 09, 2018, 08:39:53 pm »
whole statement also must be in parentheses:
[IF(["TABLE".FIELDVALUE1]>0,["TABLE".FIELDVALUE],0)]

adilsonpazzini

  • New Member
  • *
  • Posts: 29
Re: Scripts
« Reply #19 on: August 09, 2018, 08:57:14 pm »
worked thank you very much

Adilson Pazzini

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: Scripts
« Reply #20 on: December 28, 2020, 04:19:10 pm »
Hi, I know this is an old thread, but is linked in the Wiki, and the Wiki code seems that doesn't work anymore.

https://wiki.freepascal.org/LazReport_Documentation#Script

This script:

Code: Pascal  [Select][+][-]
  1. if[[LATE_FEE]=1] then Text:=[MSGL2];
  2. else Text:= [MSGL1];

Doesn't works.

But this works:

Code: Pascal  [Select][+][-]
  1. if[[LATE_FEE]=1] then Text:=[MSGL2]
  2. else Text:= [MSGL1];

The first line semicolon was removed in order to work, at least in recent trunk.

I know I can edit the wiki, but I'm asking if someone else can reproduce what I did to see if it works like that on a current release of Lazarus, since I'm using only trunk.

Thanks.

Thaddy

  • Hero Member
  • *****
  • Posts: 14197
  • Probably until I exterminate Putin.
Re: Scripts
« Reply #21 on: December 28, 2020, 04:33:40 pm »
If you are using only trunk please also give the revision you are using, because trunk is a moving target.
Such things can be caused at any given moment and also can disappear at any given moment.
If it is in the latest trunk I suggest a bug report, but people often have "a version of trunk" and you can only sanely report against the latest.
« Last Edit: December 28, 2020, 04:35:32 pm by Thaddy »
Specialize a type, not a var.

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: Scripts
« Reply #22 on: December 28, 2020, 04:35:13 pm »
If you are using only trunk please also give the revision you are using, because trunk is a moving target.
Such things can be caused at any given moment and also can disappear at any given moment.

Noting post #9 but I think the variant with the semicolon before the else is a typo and the wiki should be corrected.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Thaddy

  • Hero Member
  • *****
  • Posts: 14197
  • Probably until I exterminate Putin.
Re: Scripts
« Reply #23 on: December 28, 2020, 04:36:15 pm »
I think the same, now I looked at the wiki.
Specialize a type, not a var.

 

TinyPortal © 2005-2018