Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Post History

50%
+0 −0
Q&A TRUE/FALSE flags for alternating colouring by group

For use in connection with conditional formatting with alternating coloured fills in OpenOffice Calc, several years ago a user of Super User was applying this Ruby script: f = File.readlines("sha...

0 answers  ·  posted 3y ago by pnuts‭  ·  last activity 3y ago by pnuts‭

#3: Post edited by user avatar Alexei‭ · 2020-11-01T06:59:10Z (over 3 years ago)
#2: Post edited by user avatar pnuts‭ · 2020-10-14T19:46:08Z (over 3 years ago)
  • For use in connection with conditional formatting with alternating coloured fills in OpenOffice Calc, several years ago a user of Super User was applying this Ruby script:
  • f = File.readlines("shading.txt") #<-- I just copy and paste a column from spreadsheet to here
  • $i = 0
  • $switch = 0
  • open('shading_out.txt','a'){|g|
  • while $i < f.size do
  • if f[$i] == f[$i+1]
  • g.puts ($switch).to_s + " " + ($switch).even?.to_s
  • else
  • if $i == (f.size-1)
  • $switch-=1
  • g.puts ($switch).to_s + " " + ($switch).even?.to_s
  • else
  • g.puts ($switch).to_s + " " + ($switch).even?.to_s
  • $switch+=1
  • end
  • end
  • $i += 1
  • end
  • }
  • to derive TRUE/FALSE flags by group from a copy of a column of grouped IDs. The sample provided was provided twice, once blue/yellow/blue:
  • <pre>02902982085 4 a ? TRUE <-- true's would be blue
  • 02902982085 # 1 r TRUE
  • 02902982085 b $ 0 TRUE
  • 01395235224 w z [ FALSE <-- false's would be yellow, i.e., =NOT($E1) would be true for second conditional (see image below)
  • 01395235224 a - 5 FALSE
  • 10352351342 r . r TRUE
  • 10352351342 z 2 - TRUE
  • 10352351342 2 x 0 TRUE
  • 10352351342 q ] / TRUE</pre>
  • and once yellow/blue/yellow. The TRUE/FALSE indicator was required in Column E.
  • The [Q](https://superuser.com/questions/1118355/alternate-row-shading-by-id-conditional-formatting-in-openoffice) was essentially whether it was possible to avoid reliance on Ruby and the work that entailed.
  • Is there a way within OpenOffice Calc to generate a column of suitable TRUE/FALSE values from such data?
  • For use in connection with conditional formatting with alternating coloured fills in OpenOffice Calc, several years ago a user of Super User was applying this Ruby script:
  • f = File.readlines("shading.txt") #<-- I just copy and paste a column from spreadsheet to here
  • $i = 0
  • $switch = 0
  • open('shading_out.txt','a'){|g|
  • while $i < f.size do
  • if f[$i] == f[$i+1]
  • g.puts ($switch).to_s + " " + ($switch).even?.to_s
  • else
  • if $i == (f.size-1)
  • $switch-=1
  • g.puts ($switch).to_s + " " + ($switch).even?.to_s
  • else
  • g.puts ($switch).to_s + " " + ($switch).even?.to_s
  • $switch+=1
  • end
  • end
  • $i += 1
  • end
  • }
  • to derive TRUE/FALSE flags by group from a copy of a column of grouped IDs. The sample provided was provided twice, once blue/yellow/blue:
  • 02902982085 4 a ? TRUE <-- true's would be blue
  • 02902982085 # 1 r TRUE
  • 02902982085 b $ 0 TRUE
  • 01395235224 w z [ FALSE <-- false's would be yellow, i.e., =NOT($E1) would be true for second conditional (see image below)
  • 01395235224 a - 5 FALSE
  • 10352351342 r . r TRUE
  • 10352351342 z 2 - TRUE
  • 10352351342 2 x 0 TRUE
  • 10352351342 q ] / TRUE
  • and once yellow/blue/yellow. The TRUE/FALSE indicator was required in Column E.
  • The [Q](https://superuser.com/questions/1118355/alternate-row-shading-by-id-conditional-formatting-in-openoffice) was essentially whether it was possible to avoid reliance on Ruby and the work that entailed.
  • Is there a way within OpenOffice Calc to generate a column of suitable TRUE/FALSE values from such data?
#1: Initial revision by user avatar pnuts‭ · 2020-10-14T19:43:44Z (over 3 years ago)
TRUE/FALSE flags for alternating colouring by group
For use in connection with conditional formatting with alternating coloured fills in OpenOffice Calc, several years ago a user of Super User was applying this Ruby script:



     f = File.readlines("shading.txt") #<-- I just copy and paste a column from spreadsheet to here

    $i = 0
    $switch = 0

    open('shading_out.txt','a'){|g|
    while $i < f.size do
        if f[$i] == f[$i+1]
            g.puts ($switch).to_s + "    " + ($switch).even?.to_s
        else
            if $i == (f.size-1)
            $switch-=1
            g.puts ($switch).to_s + "    " + ($switch).even?.to_s
            else
                g.puts ($switch).to_s + "    " + ($switch).even?.to_s
                $switch+=1
            end
       end
        $i += 1 
    end
    }

to derive TRUE/FALSE flags by group from a copy of a column of grouped IDs. The sample provided was provided twice, once blue/yellow/blue:
<pre>02902982085   4   a   ?  TRUE  <-- true's would be blue
02902982085   #   1   r  TRUE
02902982085   b   $   0  TRUE
01395235224   w   z   [  FALSE <-- false's would be yellow, i.e., =NOT($E1) would be true for second conditional (see image below)
01395235224   a   -   5  FALSE
10352351342   r   .   r  TRUE
10352351342   z   2   -  TRUE
10352351342   2   x   0  TRUE
10352351342   q   ]   /  TRUE</pre>

and once yellow/blue/yellow. The TRUE/FALSE indicator was required in Column E.

The [Q](https://superuser.com/questions/1118355/alternate-row-shading-by-id-conditional-formatting-in-openoffice) was essentially whether it was possible to avoid reliance on Ruby and the work that entailed.

Is there a way within OpenOffice Calc to generate a column of suitable TRUE/FALSE values from such data?