INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Expression Problem  (Read 309 times)

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Expression Problem
« on: October 07, 2024, 11:01:26 am »

I have an issue with one expression.
To explain:
My expression search the value from 0-100, where if it finds those value it counts and then multiply by a factor.
But it seems somewhere is a bug where my expression adds an extra value. I have done some debug and search by each block of values and everything is counted correctly. But when needs to add those multiply factor, it will increase it.
Here is how my expression is composed:

Code: [Select]
math(math(
math(listcount(ListGrep([aoty list score],1))*1)+
math(listcount(ListGrep([aoty list score],2))*1)+
math(listcount(ListGrep([aoty list score],3))*1)+
math(listcount(ListGrep([aoty list score],4))*1)+
math(listcount(ListGrep([aoty list score],5))*1)+
math(listcount(ListGrep([aoty list score],6))*1)+
math(listcount(ListGrep([aoty list score],7))*1)+
math(listcount(ListGrep([aoty list score],8))*1)+
math(listcount(ListGrep([aoty list score],9))*1)+
math(listcount(ListGrep([aoty list score],10))*2)+
math(listcount(ListGrep([aoty list score],11))*2)+
math(listcount(ListGrep([aoty list score],12))*2)+
math(listcount(ListGrep([aoty list score],13))*2)+
math(listcount(ListGrep([aoty list score],14))*2)+
math(listcount(ListGrep([aoty list score],15))*2)+
math(listcount(ListGrep([aoty list score],16))*2)+
math(listcount(ListGrep([aoty list score],17))*2)+
math(listcount(ListGrep([aoty list score],18))*2)+
math(listcount(ListGrep([aoty list score],19))*2)+
math(listcount(ListGrep([aoty list score],20))*4)+
math(listcount(ListGrep([aoty list score],21))*4)+
math(listcount(ListGrep([aoty list score],22))*4)+
math(listcount(ListGrep([aoty list score],23))*4)+
math(listcount(ListGrep([aoty list score],24))*4)+
math(listcount(ListGrep([aoty list score],25))*4)+
math(listcount(ListGrep([aoty list score],26))*4)+
math(listcount(ListGrep([aoty list score],27))*4)+
math(listcount(ListGrep([aoty list score],28))*4)+
math(listcount(ListGrep([aoty list score],29))*4)+
math(listcount(ListGrep([aoty list score],30))*6)+
math(listcount(ListGrep([aoty list score],31))*6)+
math(listcount(ListGrep([aoty list score],32))*6)+
math(listcount(ListGrep([aoty list score],33))*6)+
math(listcount(ListGrep([aoty list score],34))*6)+
math(listcount(ListGrep([aoty list score],35))*6)+
math(listcount(ListGrep([aoty list score],36))*6)+
math(listcount(ListGrep([aoty list score],37))*6)+
math(listcount(ListGrep([aoty list score],38))*6)+
math(listcount(ListGrep([aoty list score],39))*6)+
math(listcount(ListGrep([aoty list score],40))*8)+
math(listcount(ListGrep([aoty list score],41))*8)+
math(listcount(ListGrep([aoty list score],42))*8)+
math(listcount(ListGrep([aoty list score],43))*8)+
math(listcount(ListGrep([aoty list score],44))*8)+
math(listcount(ListGrep([aoty list score],45))*8)+
math(listcount(ListGrep([aoty list score],46))*8)+
math(listcount(ListGrep([aoty list score],47))*8)+
math(listcount(ListGrep([aoty list score],48))*8)+
math(listcount(ListGrep([aoty list score],49))*8)+
math(listcount(ListGrep([aoty list score],50))*10)+
math(listcount(ListGrep([aoty list score],51))*10)+
math(listcount(ListGrep([aoty list score],52))*10)+
math(listcount(ListGrep([aoty list score],53))*10)+
math(listcount(ListGrep([aoty list score],54))*10)+
math(listcount(ListGrep([aoty list score],55))*10)+
math(listcount(ListGrep([aoty list score],56))*10)+
math(listcount(ListGrep([aoty list score],57))*10)+
math(listcount(ListGrep([aoty list score],58))*10)+
math(listcount(ListGrep([aoty list score],59))*10)+
math(listcount(ListGrep([aoty list score],60))*12)+
math(listcount(ListGrep([aoty list score],61))*12)+
math(listcount(ListGrep([aoty list score],62))*12)+
math(listcount(ListGrep([aoty list score],63))*12)+
math(listcount(ListGrep([aoty list score],64))*12)+
math(listcount(ListGrep([aoty list score],65))*12)+
math(listcount(ListGrep([aoty list score],66))*12)+
math(listcount(ListGrep([aoty list score],67))*12)+
math(listcount(ListGrep([aoty list score],68))*12)+
math(listcount(ListGrep([aoty list score],69))*12)+
math(listcount(ListGrep([aoty list score],70))*14)+
math(listcount(ListGrep([aoty list score],71))*14)+
math(listcount(ListGrep([aoty list score],72))*14)+
math(listcount(ListGrep([aoty list score],73))*14)+
math(listcount(ListGrep([aoty list score],74))*14)+
math(listcount(ListGrep([aoty list score],75))*14)+
math(listcount(ListGrep([aoty list score],76))*14)+
math(listcount(ListGrep([aoty list score],77))*14)+
math(listcount(ListGrep([aoty list score],78))*14)+
math(listcount(ListGrep([aoty list score],79))*14)+
math(listcount(ListGrep([aoty list score],80))*16)+
math(listcount(ListGrep([aoty list score],81))*16)+
math(listcount(ListGrep([aoty list score],82))*16)+
math(listcount(ListGrep([aoty list score],83))*16)+
math(listcount(ListGrep([aoty list score],84))*16)+
math(listcount(ListGrep([aoty list score],85))*16)+
math(listcount(ListGrep([aoty list score],86))*16)+
math(listcount(ListGrep([aoty list score],87))*16)+
math(listcount(ListGrep([aoty list score],88))*16)+
math(listcount(ListGrep([aoty list score],89))*16)+
math(listcount(ListGrep([aoty list score],90))*18)+
math(listcount(ListGrep([aoty list score],91))*18)+
math(listcount(ListGrep([aoty list score],92))*18)+
math(listcount(ListGrep([aoty list score],93))*18)+
math(listcount(ListGrep([aoty list score],94))*18)+
math(listcount(ListGrep([aoty list score],95))*18)+
math(listcount(ListGrep([aoty list score],96))*18)+
math(listcount(ListGrep([aoty list score],97))*18)+
math(listcount(ListGrep([aoty list score],98))*18)+
math(listcount(ListGrep([aoty list score],99))*18)
)+
math(listcount(ListGrep([aoty list score], 100, 0))*20))

Where my field has the value list from 0-100, delimited by ;

As more example:
[aoty list score] = 20;51;58;60;60;70;80;80;80;80;80;80;100;100
After checking those values, the expression should show a total of 198 on values, but instead put 218.


Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42298
  • Shoes gone again!
Re: Buggy Expression!
« Reply #1 on: October 07, 2024, 11:38:35 am »

I played a little and this returns 3 since the 1 is in 100 and 51:
listcount(ListGrep(20;51;58;60;60;70;80;80;80;80;80;80;100;100,1))

Are you taking that into account?
Logged
Matt Ashland, JRiver Media Center

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Buggy Expression!
« Reply #2 on: October 07, 2024, 11:57:25 am »

Does that mean each time the listgrep() will find from these values from 0-100 it will double that value? Because the only double value it comes from 51. If that can listgrep() be extended that when it founds value from a list from lets say 0-100 it will not include and double.
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42298
  • Shoes gone again!
Re: Expression Problem
« Reply #3 on: October 07, 2024, 12:01:08 pm »

Well to simplify, this:
ListGrep(20;51;58;60;60;70;80;80;80;80;80;80;100;100,1)

Returns:
51;100;100

So I think it's working like it's supposed to.  Whether that works for you is another question.
Logged
Matt Ashland, JRiver Media Center

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2513
Re: Expression Problem
« Reply #4 on: October 08, 2024, 07:20:12 pm »

I would also expect ListGrep() to find whole values, not substrings. Maybe a new mode is needed for that:

0   Perform a case insensitive search
1   Perform a case sensitive search
2   Perform a case insensitive search, match whole item string
3   Perform a case sensitive search, match whole item string

@SkGe, here's an alternate solution using 5 functions instead of 300 :)
listmath(listmix(max(math(int([L1]/10)*2),1), 0, [aoty list score]), 2)

Note that a zero input is also worth 1 point in this expression. That can be fixed if needed.
Logged

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Expression Problem
« Reply #5 on: October 09, 2024, 08:21:36 am »

Hey Zybex when you got some free times I will need to steal you for some grunt work, :) Yours is way easy and thanks.
As for Matt, maybe a way for listgrep() to be anchored in text, if a value where it will include 1 can de differentiate between numbers.

Example:
Code: [Select]
^value   would anchor value to the beginning of the string
value$   anchors value to the end of the string
^value$ means exact value
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42298
  • Shoes gone again!
Re: Expression Problem
« Reply #6 on: October 09, 2024, 08:42:19 am »

I would also expect ListGrep() to find whole values, not substrings. Maybe a new mode is needed for that:

0   Perform a case insensitive search
1   Perform a case sensitive search
2   Perform a case insensitive search, match whole item string
3   Perform a case sensitive search, match whole item string

Good idea.

Next build:
NEW: Added a couple extra modes to the ListGrep(...) expression function for full string matching.
Logged
Matt Ashland, JRiver Media Center

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Expression Problem
« Reply #7 on: October 09, 2024, 08:42:56 am »

Thanks Matt
Logged
Pages: [1]   Go Up