Tags:
create new tag
view all tags

SID-02402: Look up for item in array

Status: Answered Answered TWiki version: Perl version:
Category: CategorySearch Server OS: Last update: 6 years ago

Which command or code could best be used to find out whether an item is found in an array or not? Example: Given an array "Fruit" (strawberry, apple, pear, watermelon, kiwi, mango). Is "kiwi" in this array? --> True Is "banana"in this array? -->False I was looking in SpreadSheetPlugin for some Excel-like 'lookup'-command. But what is easiest to use?

-- Emiel Van Riel - 2019-04-25

Discussion and Answer

There are several ways. Here is one:

  • $NOT($EMPTY($LISTIF($EXACT($item, kiwi), strawberry, apple, pear, watermelon, kiwi, mango))) returns 1
  • $NOT($EMPTY($LISTIF($EXACT($item, banana), strawberry, apple, pear, watermelon, kiwi, mango))) returns 0

Try the formua at SpreadSheetPlugin

-- Peter Thoeny - 2019-04-25

      Change status to:
ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
SupportForm
Status Answered
Title Look up for item in array
SupportCategory CategorySearch
TWiki version

Server OS

Web server

Perl version

Browser & version

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2019-04-25 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.