openmolecules.org

 
Home » DataWarrior » Functionality » Updating Merged Columns
Re: Updating Merged Columns [message #1128 is a reply to message #1127] Thu, 19 November 2020 21:51 Go to previous messageGo to previous message
nbehrnd is currently offline  nbehrnd
Messages: 224
Registered: June 2019
Senior Member
Dear Ed,

based on your reply, I understand that my initial reading of your question does not fit your needs. I wrongly assumed you wish to display in column C at either the result of column A, or of column B. But you want to display both values simultaneously in one column of recalculated values.

This is possible using an expression in the following pattern

str(if(vendor_1!=0,vendor_1,"NaN")) + str("; ") + str(if(vendor_2!=0,vendor_2,"NaN"))

The expression asks both columns independently for a value -- if there is no value, these if clauses will explicitly state the absence by issuing an «NaN» string. These results, regardless if a numeric result, or some text, will be converted into a string. These are separated by a third string comprising a semi-colon and an explicit space (but it could be any other separator character, too [.cvs files]). Eventually, the plus signs are used to concatenate the parts into the string displayed in the table.

Et voilà, in the sixth column (an example .dwar file is attached, too):

index.php?t=getfile&id=295&private=0

Norwid
  • Attachment: adjust.dwar
    (Size: 2.34KB, Downloaded 361 times)
  • Attachment: adjust-or8.png
    (Size: 16.60KB, Downloaded 617 times)
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Copy and paste from Chemdraw to Datawarrior structure
Next Topic: pchembl values
Goto Forum:
  


Current Time: Fri Nov 22 13:59:14 CET 2024

Total time taken to generate the page: 0.04995 seconds