@Select May not do what you think it will - Use @Subset

Domino Resources - Part 2

Looking for something else?

I had two related list fields in my document,

Item and Weight. My users wanted the total weight field to exclude the wight of Carbon Dioxide (Item Code "CO2"). This seemed simple. Find out the Item element number = "CO2", and subtract the value of the same element in the weight list from the original summed field..... But all was not what it seemed.

CODE:
Here was my initial code to get field TotalWeight:

Item Weight

Item01 10.00
CO2 20.00
Item02 30.00
Item03 40.00

Elem=@Member("CO2";Item);

Elem now contains the position in the array of the text "CO2", 2.

CO2Weight=@Select(Elem;Weight);

CO2Weight should now contain 20.00.

@Sum(Weight)-CO2Weight

The total weight without CO2's weight.

But, Aargghh, CO2Weight returned the entire list of numbers... 10.00 ; 20.00 ; 30.00
; 40.00

Anyway, after a lot of faffing about, doubting my work, checking the manuals,
banging my head against the desk etc I finally searched the lotus knowledge base
and found this at

http://www.support.lotus.com/sims2.nsf/802ee480bdd32d0b852566fa005acf8d/489569fb8e698275862565460072209a?OpenDocument&Highlight=2,%40Select

"The @Select function in Notes 4.x does not provide the ability to return the Nth
item of an arbitrary list. It will work only if you specify your semicolon-separated
list explicitly when you write the formula. How can a given element of a list be
returned using formulas?

Solution:

Nested @Subset calls can achieve this, as follows:

@Subset(@Subset(list;N);-1)

Where N is a number representing which element you would like to select, with the
first element being number 1.

The inner @Subset call selects all elements of a list up to and including the number
you specify (1 through N). The outer @Subset selects just the last element of the
previous list (element N only).

In a similar way, you can access the Nth-to-last element of the list via:

@Subset(@Subset(list;-N);1)

In this case, the inner @Subset returns a list counting backwards from the end of the
list, consisting of N items, and the outer @Subset call returns the first of these (the
last element if N is 1, the second-to-last element if N is 2, etc."

WELL THANKS FOR TELLING US!!!

This was last published in November 2000

Start the conversation

Send me notifications when other members comment.

SearchWindowsServer

• Server Core management remains a challenge for some

Server Core, the minimal Windows Server deployment, removes some admins from their GUI comfort zone, but its benefits reduce some...

• Meltdown and Spectre vulnerabilities dominate January Patch Tuesday

Complications surrounding the fix for the Meltdown and Spectre microprocessor architecture flaws will make the patching process ...

• Windows Server hardening still weighs heavily on admins

Windows Server hardening procedures drew renewed interest following the rash of ransomware outbreaks this year. See what tips on ...

Search400

• iSeries tutorials

Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

• Connecting multiple iSeries systems through DDM

Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

• Three requirements for a hybrid cloud computing deployment

As the hybrid cloud computing approach gains steam, organizations will need to pay close attention to cross-cloud connectivity ...

• Five debunked myths about SSD issues

Solid-state drives are mature now, and the technology has eclipsed hard disk drives with superior performance, manageability and ...

• Future data center trends hinge on the edge, cloud and staffing

Edge computing, colocation, cloud and IT staffing issues lead the way as industry analysts make their predictions for the future ...

SearchExchange

• Compliance Manager tool aims to ease security audit process

Administrators who wrestle with compliance tasks in Office 365 and Azure workloads might find some relief with Microsoft's ...

• Set Office 365 group limits to avoid administrative hassles

With help from PowerShell, administrators can tailor Office 365 Groups to develop common-sense restrictions on the tools and ...

• The top Exchange and Office 365 tutorials of 2017

Exchange Server remains a solid messaging choice, but interest in Microsoft's cloud platform shows no sign of abating. These ...

SearchContentManagement

• Intelligent information management the next wave for ECM

In a 2018 upgrade, M-Files allows users to search for content in multiple repositories, while also being able to automatically ...

• SharePoint integration and implementation best practices

Here are some expert advice and tips, as well common definitions, to help make your SharePoint integration and implementation a ...

• SharePoint branding capabilities get a facelift

Since Microsoft Ignite last September, SharePoint Online is getting new branding capabilities that have been on the wish lists of...

Close