Re: Row Wise Sum [message #1927 is a reply to message #1926] |
Tue, 13 June 2023 20:49 ![Go to previous message Go to previous message](/forum/theme/myThemeWithHFCSS/images/up.png) ![Go to next message Go to previous message](/forum/theme/myThemeWithHFCSS/images/down.png) |
nbehrnd
Messages: 215 Registered: June 2019
|
Senior Member |
|
|
Dear Angus,
to answer the first question, you need a placeholder which either returns `0` (if there is nothing in the cell), or the value of the cell (if the cell contains an entry acceptable for an addition); `replaceempty` is suitable here. For the second question, you already tap against a good door; you now need to know how to negate a Boolean in DataWarrior's syntax.
For the purpose of illustration, I attach a minimal working example below. Departing from a small library of random molecules, DataWarrior computes the number of H-Donors and H-Acceptors. Manually added -- leaving some gaps is intentional -- two additional columns with manual entries, `counter_a` and `counter_b`. The `special_sum` then
HAcceptors + HDonors + replaceempty(counter_a, 0) + replaceempty(counter_b, 0)
either adds either the results of DataWarrior's intrinsic functions plus the zeroes, or the values of the additional columns. To count the the non-empty columns `!` offers to define
!isempty(HAcceptors) + !isempty(HDonors) + !isempty(counter_a) + !isempty(counter_b)
You can access, adjust and update the equations in question in the header cell of the corresponding column 7 and 8 (clique with the right mouse button).
With regards,
Norwid
|
|
|