Evaluate second line in text

Post your questions and help other users.

Moderator: Martin

Post Reply
Lucy
Posts: 224
Joined: 10 Aug 2019 11:24

Evaluate second line in text

Post by Lucy » 18 Nov 2019 00:27

Hi.
I have a notification that displays its content in 3 separate lines.
The content on the second line is all i want automagic to concentrate on. It is a numeric only line and i was hoping for some help on...
Having automagic determine if the number is greater than, lesser than, etc.
I know the operators "<>=" and so forth. My issue is that i have no idea how to evaluate ONLY the second line.

Horschte
Posts: 53
Joined: 03 Nov 2014 18:00

Re: Evaluate second line in text

Post by Horschte » 18 Nov 2019 21:01

Try to split the notification to get the second line:

Code: Select all

lines = split(notification_text, "\\n");
target_line = lines[1];

Lucy
Posts: 224
Joined: 10 Aug 2019 11:24

Re: Evaluate second line in text

Post by Lucy » 19 Nov 2019 04:15

Thanks sweetie.. I'll have a go

Lucy
Posts: 224
Joined: 10 Aug 2019 11:24

Re: Evaluate second line in text

Post by Lucy » 19 Nov 2019 08:22

Ok i had a go at it but i used a text file to test.
It errors for me and have no idea how to fix it.
This is my script...


lines = split({file_text}, "\\n");
target_line = lines[1];
if (target_line >=20)
{
global_update_mod = "true";
}
else
{
global_update_mod = "false";
}

What am i doing wrong?

Horschte
Posts: 53
Joined: 03 Nov 2014 18:00

Re: Evaluate second line in text

Post by Horschte » 19 Nov 2019 15:17

Add a Debug Dialog and have a look at "target_line". What's its value?

Lucy
Posts: 224
Joined: 10 Aug 2019 11:24

Re: Evaluate second line in text

Post by Lucy » 19 Nov 2019 23:48

😂 thanks... debug showed i had the wrong kine. Ok now i have intercepted the line i want... i am stuck once more.
By using several ">" on different value types does not work. It ignores all except the lowest value. Meaning if i have it for...
>30
>20
>10
And i ask it to determine >30 it will just accept the >10 because it is more than 10.
How can i write it so that it is "more than but less than"?
I tried a simple >30<40 but that did not work. Whats the correct way to write it please?

Lucy
Posts: 224
Joined: 10 Aug 2019 11:24

Re: Evaluate second line in text

Post by Lucy » 20 Nov 2019 02:27

Ugh... it simply cant handle several of those statements at a time. And just gives me a null for high numbers like 30. It works ok if i just use a couple

Horschte
Posts: 53
Joined: 03 Nov 2014 18:00

Re: Evaluate second line in text

Post by Horschte » 20 Nov 2019 18:10

How can i write it so that it is "more than but less than"?
I tried a simple >30<40 but that did not work. Whats the correct way to write it please?

Code: Select all

if(v > 30 and v < 40){
  //do something
}

Lucy
Posts: 224
Joined: 10 Aug 2019 11:24

Re: Evaluate second line in text

Post by Lucy » 20 Nov 2019 18:40

Lol everything is so simple and straightforward but it eludes me because i always look at it as difficult 😂🤦‍♀️
Thanks.. I'll play around with it

Lucy
Posts: 224
Joined: 10 Aug 2019 11:24

Re: Evaluate second line in text

Post by Lucy » 20 Nov 2019 20:06

Ooooh... that seems to be working, thank you. After sufficient data is logged for it to trigger i will have properly tested it then

Post Reply