Computed Pictures in Outlines and why this function is a mess

Well any of you who have used EmbeddedOutlines in forms will have noticed that you can program every aspect of the outlines entries.You can use formulas to vary the title of the entry, the source, the frame, hide when and even the picture that should be used.

At first glance this looks to be perfekt for a fully configurable navigation where the administrator of that database can enter how the database should be navigated without having to discuss each and every navigational change with the developer.

As i said “at first glance”.

As a developer you try to minimize the computation effort in such cases and to not overuse @dblookups, which are needed to support such a feature. As you do so you build a navigator form where you have one or more computed for display fields on it with some formula like this:

@DbLookup( “” : “NoCache” ; “”:“” ; “($LUConfig)” ; “USERVIEWSMAIN1” ; 2 ;[FailSilent])

Those fields get the values needed for navigation with one dblookup against a configuration document. Then you rebuild the outline entries so that each uses its own element to ask for:

What is my title?

key:=“outdefmain1view01”;

REM {find number of documents in view};

@If(UserviewsElements_1 >= 1;

@Do(

_ViewColumnNumber := @Word(Userviews_1[1];“#”;2);

_DocCounterList := @If(_ViewColumnNumber != “”;@DbColumn(“”:“NoCache”;“”:“”;@Word(Userviews_1[1];“#”;1);@TextToNumber(_ViewColumnNumber));“”);

_DocCounter := @Elements(_DocCounterList);

_label:=@Trim(@Middle(FIELDLABELS; key + “=” ;“;”));

@If(_label=“”;“(?)”+key;_label) + @If(_ViewColumnNumber != “”;" (" + @Text(_DocCounter) + “)”;“”)

);“”)

Where is my source?

@If(UserviewsElements_1 >= 1;@Word(Userviews_1[1];“#”;1);“”)

When should i hide?

UserViewsElements_1 < 1

And as all this works properly you decide to even let the user take charge of the icon that can be displayed before the title and you try do do it the same way you did with every other element in the outline entry:

_ViewPicture := @Word(Userviews_1[4];“#”;3);

@If(_ViewPicture != “”;_ViewPicture;“”)

And this simply does not work. You poke around trying to figure out why not and check if there is something wrong with your configuration entrys. Nope nothing wrong. After some hours of investigating you find that the pictures element of outlines does not work the same way all the other elements do.

If you get a picture this way manually:

“16x16_people.gif”

or this way, by entering a formula:

@If(@Name([CN];@UserName) =“John Doe”;“16x16_people.gif”;“”)

Or this way by using a configuration document:

_Userviews := @DbLookup( “” : “NoCache” ; “”:“” ; “($LUConfig)” ; “USERVIEWSMAIN1” ; 2 ;[FailSilent]);

_ViewPicture := @Word(_Userviews[2];“#”;3);

@If(_ViewPicture != “”;_ViewPicture;“”)

it works.

But if you do it this way:

_ViewPicture := @Word(Userviews_1[3];“#”;3);

@If(_ViewPicture != “”;_ViewPicture;“”)

Which is in fact the same as the last example that works that i mentioned only that you rely on the previously mentioned CFD field, this DOES NOT WORK.

So what you’ll have to do is instead of using one dblookup to get all the navigationconfigrationentrys and then going to work with the field computed by this dblookup you have to do this again and again for every entry you want to make configurable.

this means a lot of unnecessary @dblookups.

Thank you IBM and if any of you read this. Features that work 100 or at last 99,9 % are in my humble opinion of much more value then integrating a lot of fancy new stuff.

Thomas

P.S. and yes this is going to bcome an ESR as soon as i can extract this to a simpler database.