# Active Tab List without custom function

**URL:** <https://the.fmsoup.org/t/active-tab-list-without-custom-function/2237>\
**Category:** Resources\
**Tags:** scripting\
**Created:** [June 21, 2021, 9:57am UTC](https://the.fmsoup.org/t/active-tab-list-without-custom-function/2237 "2021-06-21T09:57:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![AndyHibbs](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/andyhibbs/32/3089_2.png) [@AndyHibbs](https://the.fmsoup.org/u/AndyHibbs)\
**Post date:** [June 21, 2021, 9:57am UTC](https://the.fmsoup.org/t/active-tab-list-without-custom-function/2237/1 "2021-06-21T09:57:22Z")

</div>

In case this is useful to anyone, or in case anyone spots an error, I had the need today to create a list of active tab panels in a layout to revert to after running a script that could change these.

There is an ‘tabsActive’ custom function on Brian Dunning’s website [FileMaker Custom Function: tabsActive ( layoutObjects )](https://www.briandunning.com/cf/694) but we are continuing to move away from custom functions now that we have the While() function.

This appears to work upon first testing:

```auto

While ( [
//initialVariables
	~file = Get ( FileName ) ;
	~layout = Get ( LayoutName ) ;
	~objects = LayoutObjectNames ( ~file ; ~layout ) ;
	~objectCount = ValueCount ( ~objects ) ;
	~tab = "" ;
	~res = ""
] ;
//condition
	~objectCount > 0
;
//logic
[
	~tab = If ( GetLayoutObjectAttribute ( GetValue ( ~objects ; 1 ) ; "isFrontTabPanel" ) = 1 ; GetValue ( ~objects ; 1 ) ; "" ) ;
	~objectCount = ~objectCount - 1 ;
	~objects = RightValues ( ~objects ; ~objectCount ) ;
	~res = 
		Case (
			IsEmpty ( ~tab ) ; ~res ; 
			IsEmpty ( ~res ) ; ~tab ;
			~res & ¶ & ~tab 
		)
] ;
//result
	~res
)

```

Kind regards  
Andy

---

<div class="post-metadata">

**Author:** ![AndyHibbs](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/andyhibbs/32/3089_2.png) [@AndyHibbs](https://the.fmsoup.org/u/AndyHibbs)\
**Post date:** [June 21, 2021, 10:38am UTC](https://the.fmsoup.org/t/active-tab-list-without-custom-function/2237/2 "2021-06-21T10:38:23Z")

</div>

I forgot to mention, each tab must have an object name applied for the above to work

---

<div class="post-metadata">

**Author:** ![Malcolm](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/malcolm/32/196_2.png) [@Malcolm](https://the.fmsoup.org/u/Malcolm)\
**Post date:** [June 21, 2021, 6:22pm UTC](https://the.fmsoup.org/t/active-tab-list-without-custom-function/2237/3 "2021-06-21T18:22:22Z")

</div>

Is it possible to reconstruct this in the wrong sequence? In other words, have all the correct tabs showing topmost but because of stacking order, have a different view?

---

<div class="post-metadata">

**Author:** ![AndyHibbs](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/andyhibbs/32/3089_2.png) [@AndyHibbs](https://the.fmsoup.org/u/AndyHibbs)\
**Post date:** [June 21, 2021, 7:12pm UTC](https://the.fmsoup.org/t/active-tab-list-without-custom-function/2237/4 "2021-06-21T19:12:24Z")

</div>

Hi Malcolm

Yes, absolutely. There is no layering data involved, so tabs within tabs could result in a different view. This works the same way as the custom function and was was fine for my needs.

To be honest, in most cases opening a new window, carry out a find, set the data and close the card is the safest way to preserve the view.

Kind regards  
Andy

---

<div class="post-metadata">

**Author:** ![AndyHibbs](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/andyhibbs/32/3089_2.png) [@AndyHibbs](https://the.fmsoup.org/u/AndyHibbs)\
**Post date:** [June 21, 2021, 9:30pm UTC](https://the.fmsoup.org/t/active-tab-list-without-custom-function/2237/5 "2021-06-21T21:30:03Z")

</div>

A later thought on this. If some sort of layered info was added to the tab panel object names, then it would be possible to control the order in which the data was used to ensure the view remained correct.
