Stefan Ritt wrote: |
mike cianci wrote: |
Sorry to bother you. I could see in past Forum entries that the question of "Simple Math" has come up before, although the answers were not all that simple.
Can you do simple math (i.e. attribute A + attribute B = attribute C) in ELOG ?
Thank you for putting up with my questions.
Mike
|
No, you can't. The only way is to export a logbook to CSV, then import it in a spreadsheet program, then do the math there.
|
You can pass numerical attributes to an external command via "Execute new =...". This external command can then do the math and pass the result _back_ to the logbook either as a new entry or as an edit with the command-line client "elog".
For example, given a new entry with (numerical) attributes A and B, if you have
Execute new = add_them.pl $A $B $message id
in your elog.cfg file, then $A and $B will be passed to the add_them.pl perl script. Now have the perl script (or bc, or whatever you want to use) do the appropriate math and submit the result. For example, your perl script might include
$C=$A+$B
$D=$A*$B
elog -a C=$C ... -e "$message id" "Sum as edit"
elog -a D=$D ... "Product as new entry"
|