If your Tooltip Lookup values are not displaying correctly

Tips submitted by PHPMaker users
Post Reply
bobmulder5555
User
Posts: 60

If your Tooltip Lookup values are not displaying correctly

Post by bobmulder5555 »

Using tooltips - for me at least - can sometimes be challenging. Regenerating the code can turn correctly displaying tooltips into displaying their keyvalue only. When you turn the listoption on, it works. But then you have an extra unwanted column. You can turn the display off, but then you still have an unwanted column header. You can turn THAT off, but I found out that it sometimes worked and sometimes not.

I had also noticed that if my tooltip data was already present (i.e. a View already had the display-data on-board) it would work. And only with tooltips (or with fields you don't display in Listview, I don't know). The 'normal' lookups , like changing a key into a name, perfect.

Anyway, working against a deadline I did the following: (admittedly not thousands of records (around 1000))

A. In User LoggedIn:
Throw all instances of your keys and their tooltips into a $SESSION array
I.e.:
$sql="select ZVL_ID, ZVL_ToolTipField from tbl3_zvl_zorgverlener";
$artsarray=ew_ExecuteRows($sql);
$
SESSION["artsarray"]=$artsarray;

B. In the troubled Table of View, go to Row_Rendering:
$artsarray=$_SESSION["artsarray"]; //get the array back from session; Im sure you could skip this, but I like my statements not too long or complex, so when revisiting I'm up to speed quicker
$arts=$this->RI_ZVL_ID_huidig_tt->DbValue; //get the keyvalue from your tooltip
$keya= array_search($arts, array_column($artsarray,0)); //find that key in the array you saved your key+tooltip in
$arts=$artsarray[$keya][1]; //replace the keyvalue with the text you found
$this->RI_ZVL_ID_huidig_tt->ViewValue=$arts; //put it back as viewvalue in your tooltip field.

So, now we basically have done the same as a lookup does. Maybe it's a timing problem, if you have a lot of lookup fields in a record, the database is not quick enough. I just don't know.

But this seems to be a reliable workaround that worked out of the box.

Hope somebody will find this usefull. Cheers, Bob


Post Reply