A slightly corrected/modified version. To set the baseID:
set the baseID of this stack to baseID(newID) To get the baseID get the baseID of this stack. The function(s) then become function baseID newID if newID is empty then return baseID_newIDempty() else return baseID_newIDnotempty(newID) end if end baseID function baseID_newIDempty if not exists (the baseID of this stack) then return "this card" else return the baseID of this stack end if end baseID_newIDempty function baseID_newIDNotEmpty newid if exists newID then return newID else return "this card" end if end baseID_newIDNotEmpty Pete lcSQL Software <http://www.lcsql.com> Home of lcStackBrowser <http://www.lcsql.com/lcstackbrowser.html> and SQLiteAdmin <http://www.lcsql.com/sqliteadmin.html> On Tue, Jan 20, 2015 at 8:45 AM, Peter Haworth <p...@lcsql.com> wrote: > I'd go with the first one. The second one makes my eyes glaze over! Plus I > think there should be an else before the second if in the second function. > > I might consider something like this. > > function baseID newID > if newID is empty then > baseID_newIDempty > else > baseID_newIDnotempty > end if > Return the baseID of this stack > end baseID > > The two subsidiary handlers would have the logic from your first function > for empty/not empty. > > Pete > lcSQL Software > It would be good to post code that works: > > function baseID newID > if (newID is not empty and not exists(newID)) or \ > (newID is empty and not exists(the baseID of this stack)) then \ > set the baseID of this stack to "this card" > if newID is not empty then set the baseID of this stack to newID > return the baseID of this stack > end baseID > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode > _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode