Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Some help with Trog's Super Text Box

For general discussion related FlowStone

Some help with Trog's Super Text Box

Postby billv » Fri Sep 03, 2021 8:45 pm

Hi..Greetings from Down Under :D
I need some help. My ruby skills aren't good enough.
Trog has explained the code really well in this schematic, but I can't work it out :?
All I need is Sort 'trigger" for the QTY Column.The problem is how to make all the rows
sort the same way according to the values in the QTY Column... :?:
Super Text Box Problem.fsm
(11.72 KiB) Downloaded 591 times
billv
 
Posts: 1141
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia

Re: Some help with Trog's Super Text Box

Postby tulamide » Sat Sep 04, 2021 1:00 pm

I'm not sure I understood. Anyway, here's an external trigger, that sorts based on qty. The first time it's sorting low to high, the second time high to low.

If you wanted to know the general technique, it's :sort_by! of the array class.
Code: Select all
array = [
["John", "Doe", 20],
["Jane", "Doe", 18],
["Annie", "Thing", 34]
]
array.sort_by! { |obj| obj[2] }
##sorts the array of arrays based on the contents of their third items, here the age number##
Attachments
Super Text Box Problem (tula).fsm
(11.91 KiB) Downloaded 570 times
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2686
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Some help with Trog's Super Text Box

Postby billv » Sat Sep 04, 2021 9:03 pm

:D Awesome..works perfect..thanks tulamide :)
billv
 
Posts: 1141
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia

Re: Some help with Trog's Super Text Box

Postby tulamide » Sun Sep 05, 2021 9:20 pm

billv wrote::D Awesome..works perfect..thanks tulamide :)

You're welcome :D

I just want to take the opportunity to point out, that this was only possible, because Trog, although having a large code base, has it structured very well, so that I could relatively easy follow his thoughts and layout of the code. That was even more important than the documentation!

Most people neglect that. Please don't. At one point sooner or later, you will need help with your own code. Make sure it is easily readable (for someone who knows Ruby). Stick to the conventions and styles, the Ruby community agreed on, and it will be so much easier to help you.

https://rubystyle.guide/
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2686
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany


Return to General

Who is online

Users browsing this forum: No registered users and 59 guests