Scripting Bugs

Things you’d like to miss in the future...
admin
Site Admin
Posts: 60595
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Scripting Bugs

Post by admin »

Thanks, fixed in next version.

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Scripting Bugs

Post by TheQwerty »

Custom columns do not seem to like functions (or multiple 'returns'):

Code: Select all

Snip: CustomColumn 1
  XYplorer 17.70.0208, 3/22/2017 7:36:18 AM
Action
  ConfigureColumn
Caption
  Test
Type
  3
Definition
  function A() { return 'A'; }
  function C() { return B() . 'C'; }
  function B() { return A() . 'B'; }
  
  return C() . 'D';
Format
  0
Trigger
  0
Item Type
  2
Item Filter
  
Column shows:

Code: Select all

B() . 'C'
If you swap the lines defining C() and B() (so they are in a logical order) the column shows 'AB'.

In both cases it should be showing 'ABCD'.

admin
Site Admin
Posts: 60595
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Scripting Bugs

Post by admin »

You got it, functions are not supported here. Too slow.

Hmm, apparently not totally true. Needs further investigation...

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Scripting Bugs

Post by TheQwerty »

Combination of functions and concatenation perhaps?

admin
Site Admin
Posts: 60595
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Scripting Bugs

Post by admin »

No, I just finished the thinking: User functions are not supported in the column scripts. Will update Help file.

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Scripting Bugs

Post by TheQwerty »

admin wrote:No, I just finished the thinking: User functions are not supported in the column scripts. Will update Help file.
But they can still be used if the CC loads a script file, right?

admin
Site Admin
Posts: 60595
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Scripting Bugs

Post by admin »

Yep. Just not right in the top script.

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Scripting Bugs

Post by TheQwerty »

Not looking forward to the confusion this will cause but I'm okay with the limitation.

admin
Site Admin
Posts: 60595
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Scripting Bugs

Post by admin »

Sigh, you are right, of course. Okay okay...

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Scripting Bugs

Post by TheQwerty »

admin wrote:Sigh, you are right, of course. Okay okay...
No, it's really okay - that was not an attempt to guilt you into making it work.

If that's a limitation of CCS and it is documented then it is perfectly okay in my mind to have this limitation.
There are already differences in how the CCS dialog takes scripts vs other places in XY.

A Run Script UDC is a single line - the Edit button for multi-line creates a multi-script resource and thus requires paying the normal amount of care to whitespace.

CCS starts with a multi-line field and graces the user with some leniency over the whitespace handling. If this comes at the cost of user functions that is fine. In fact, it's almost good in that it discourages a user from using them here where execution complexity impacts navigation speed most. Further functions are still allowed in a loaded script file so nothing is truly lost.

Documenting the limitation is all this is needed. :tup:

admin
Site Admin
Posts: 60595
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Scripting Bugs

Post by admin »

Already done. :beer:

autocart
Posts: 1248
Joined: 26 Sep 2013 15:22

Re: Scripting Bugs

Post by autocart »

XYplorer 17.80.0006 (Win 8.1 x64)

INTEGER DIVISION = is being rounded half away from zero (wird kaufmännisch gerundet)

I don't think that the help file says that nor that it is intended, right?
To confirm, try:
::echo 5.49 \ 2; //returns 2
::echo 5.50 \ 2; //returns 3

also:
::echo 5.5 \ 2.49;
::echo 6 \ 2.49; //return 3
and
::echo 5.5 \ 2.5;
::echo 6 \ 2.5; //return 2

LittleBiG
Posts: 1846
Joined: 08 Apr 2011 12:57
Location: Win10x64

Re: Scripting Bugs

Post by LittleBiG »

autocart wrote:XYplorer 17.80.0006 (Win 8.1 x64)

INTEGER DIVISION = is being rounded half away from zero (wird kaufmännisch gerundet)

I don't think that the help file says that nor that it is intended, right?
To confirm, try:
::echo 5.49 \ 2; //returns 2
::echo 5.50 \ 2; //returns 3

also:
::echo 5.5 \ 2.49;
::echo 6 \ 2.49; //return 3
and
::echo 5.5 \ 2.5;
::echo 6 \ 2.5; //return 2
It is in sync with the help file because it says that in case of integer division, the operands are rounded before the operation. Then the fraction part will be stripped. So everything you brought as example are expected. (However, personally this integer division seems pretty meaningless to me...)

autocart
Posts: 1248
Joined: 26 Sep 2013 15:22

Re: Scripting Bugs

Post by autocart »

LittleBiG wrote:It is in sync with the help file ...
Thx, LB,
I should have finished that sentence in the help file and studied all the examples more carefully.
The sentence in the help file reads:
"With integer division (the portion of the result after the decimal point is lost) and modulo (the remainder of integer division) the operands are rounded before the operation!"
I stopped reading at the word "modulo". :titter: :roll: sorry.
Plus, a search in the forum brought up this post:
viewtopic.php?f=7&t=13822&p=124978&hili ... on#p124978
which mislead me even more. Thx for the correction. Sorry again.

Filehero
Posts: 2644
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

Re: Scripting Bugs

Post by Filehero »

Should the message really pop up?

Code: Select all

 //          v <-- note the SECOND closing bracket here
  if (1 == 2)) {
    msg("Wouw, Math revolution!");
  }

Post Reply