From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id kEOIDTQ5p2LUBgEAbAwnHQ (envelope-from ) for ; Mon, 13 Jun 2022 15:18:44 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id yOCVDDQ5p2JtagAAG6o9tA (envelope-from ) for ; Mon, 13 Jun 2022 15:18:44 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id DCB4F1B524 for ; Mon, 13 Jun 2022 15:18:43 +0200 (CEST) Received: from localhost ([::1]:53868 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o0jxq-00023p-J9 for larch@yhetil.org; Mon, 13 Jun 2022 09:18:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57960) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o0jx5-00021x-VK for emacs-orgmode@gnu.org; Mon, 13 Jun 2022 09:17:55 -0400 Received: from ciao.gmane.io ([116.202.254.214]:60798) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o0jx4-0002yz-Er for emacs-orgmode@gnu.org; Mon, 13 Jun 2022 09:17:55 -0400 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1o0jx1-0006E8-8v for emacs-orgmode@gnu.org; Mon, 13 Jun 2022 15:17:51 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-orgmode@gnu.org To: emacs-orgmode@gnu.org From: Uwe Brauer Subject: orgtables should taking into account empty cells when adding Date: Mon, 13 Jun 2022 15:17:44 +0200 Message-ID: <87tu8oem87.fsf@mat.ucm.es> Mime-Version: 1.0 Content-Type: text/plain User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cancel-Lock: sha1:R9tG2v2kPhzAgjNOVbToHOQve4k= Mail-Copies-To: never Received-SPF: pass client-ip=116.202.254.214; envelope-from=geo-emacs-orgmode@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1655126324; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=KA4uFEDO7radfR/eoW/OipvFgLIVZHCK6wrMJLDfjKg=; b=Oy+xC/1KBACGgBtARNeuu+o4adIFPys7RY2ZOvSlPaUwRuhtEQelBtvlMdQjrAcGh6fzQp UB5B53cfC3HgF4namKZo4juMOfvD5o3n1sL651FP7BlouRMv69p5N/PpMXfzh++x1Ywj0z Oan7yNUD7IC4Dk5vzfwnIYLfzuw87U9ZOLUDpAdxydrI4QHG+quI8vTsXT0rp1YKgQJ9Cd 8cPyFf1pdBlqAK9PRnvFdguImcB80N9fYIQS2KYPnvD0Z9jtplABZn3nediLTz1dMzpLZi wNLo5+s6oLeGBCV22hOr3yQtmPnyPJrXJgctA8Ul5OMA/YbOpVJAiYTC6xeSjA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1655126324; a=rsa-sha256; cv=none; b=Mc2D1XTlPEA/54qOhN6sR7VTXgaAQ3EkevuDiaTJGwqzMgNl3znEM273yqu+1yf2eQiHT6 ZGqYXGdLySLA211HFoiIgvbbCZeJlCQVCI1XsGbzLBMeUyRWtERUtZR4mPA+QUl+Mebqv8 GC/6AX4K4VuHMAsVb4B+HPPCN4nKHO9z9Io7rpcEMlTKKFXCthmb5lw4YUhow6k9bBC0Ih 6wSEsjX0mSUG8WIx+142VEAiNqqW7eUYUw6isxLB9xcx36S+y1d6UNjvy/rbZaF/AKw/X3 /Qe3ip0mtYSAiJvyXUKlhFM2zE3zoz5oF+8p7Gx4Y4zwLlaPZ+XZnFRdQtMMdQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=mat.ucm.es (policy=none); spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 2.21 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=mat.ucm.es (policy=none); spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: DCB4F1B524 X-Spam-Score: 2.21 X-Migadu-Scanner: scn0.migadu.com X-TUID: A1z46cvpg2hR Hi Consider please #+begin_src emacs-lisp :results silent :exports none | Name | Theory | Matlab | Exercises | Result | |-------+--------+--------+-----------+--------| | User1 | 5 | 2 | 1 | 8 | | User2 | | 2 | 1 | NP | | User3 | 4 | 1 | | NP | ,#+TBLFM: $5=if(typeof(vsum($2..$4)) == 12 , string("NP"),vsum($2..$4)); E f-1 #+end_src Each cell in a row that is empty results in the string NP, so far so good. Now I want to achieve the same but only if cells in the second column are empty. So I thought #+begin_src emacs-lisp :results silent :exports none | Name | Theory | Matlab | Exercises | Result | |-------+--------+--------+----------+-------| | User1 | 5 | 2 | 1 | 8 | | User2 | | 2 | 1 | NP | | User3 | 4 | 1 | 0 | 5 | #+TBLFM: $5=if("$2" == "nan", string("NP"),vsum($2..$4)); E f-1 #+end_src That looks ok, however when say a cell in the third column is empty, the problem starts because it results in #+begin_src emacs-lisp :results silent :exports none | Name | Theory | Matlab | Exercises | Result | |-------+--------+--------+-----------+--------| | User1 | 5 | 2 | 1 | 8 | | User2 | | 2 | 1 | NP | | User3 | 4 | 1 | | nan | ,#+TBLFM: $5=if("$2" == "nan", string("NP"),vsum($2..$4)); E f-1 #+end_src Any idea how to solve this problem (I don't know how to have several ifs in such expression) regards Uwe Brauer