wrong/crazy number display in xpages dynamic view - xpages-extlib

I have a crazy effect when displaying in view with a number column in a dynamic view panel of an xPage:
Some (not all!) entries are displayed like:
123.40000000000005
the value in the notes doc is 123.4 .
I cannot found any difference between that wrong displayed value and others, which are displayed correctly.
I tried a few number formatting things in the column properties of the notes view: does not improve.
the notes view displayed everything well (for the notes client).
Is it a bug? Or did a forget some format settings for the dyn view control?
Thanks in advance, Uwe

Its not a bug, more like a side effect.
Well because it is double, there is way to put floating point numbers in memory, sometimes it behaves "little bit strange" but its just a side effect. So there is sometimes small error in numbers.
read this: http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
it explains how floating point works.
regards

tmp:=yourfield;
#Round(tmp*100)/100

Related

What is the "for identifier" in a formRow good/used for?

The extension library offers means to structure your forms by Form Tables, where you can put Form Layout Columns and Form Layout Rows.
The Form Layout Rows have a property called "for" (the "For Indentifier") - here is the OnHover-text:
"Holds the ID of the control used to edit the data. That control should be contained within this Form Layout Row control."
So, I could enter the id of e.g. an Edit Box control I put into this form row (which translates to the code ' for="inputText1" '). But what exactly is this needed for? Where or for what can this information be used?
I found no different behaviour or limited functionality when sparing this information - at least, not how we use it atm. I found nothing in the web regarding this question; hope anyone can shed some light.
It's useful if your form row contains multiple controls, preventing the form row's code from determining its "for" target automatically. In that situation, you can provide the server-side ID of the "real" target control in the row to keep the label behavior working properly.
It's also mandatory to set this attribute if you want to use the built-in OneUI or Bootstrap themes to have the label formatted correctly. For example the text will be bold only if you set the for attribute (Bootstrap acts like this)

drupal 7 nodes listed in views are not attached to the menu, but need to be

Using Drupal 7, I am displaying news articles via a View. The view is linked into the menu, naturally, but as a consequence the news articles are not. This becomes an issue because when an article's detail page is displayed, the site loses the active trail and consequently the breadcrumb trail and the left-hand secondary navigation menu lose their place.
Is there some way of setting the menu to think it's in a certain place within the menu tree, eg. Your College -> Life at the College -> News & Events?
I've seen menu_tree_set_path, which looks promising, but haven't seen an example of how it's used (at least in terms an Enthusiastic Amateur like myself would get).
As ever, any and all assistance given is greatly appreciated,
~Matt
The Context module will allow you to set the active trail of a drupal menu dependant on paths etc.
https://drupal.org/project/context
When you're dealing with breadcrumbs, an easy way to achieve breadcrumbs on a per content type basis (and others) is the custom_breadcrumbs module.
On a separate note, if you want to display full menus, look at the menu_block module. We used this plus the menu_tree_set_path() function to display local menus on nodes that weren't in menus.
$config = menu_block_get_config(1);
$path = "node/{$nid}";
menu_tree_set_path($config['menu_name'], $path);
$data = menu_tree_build($config);
The number passed to menu_block_get_config(), is the delta of the menu_block configuration in blocks.
With $data you can use a drupal_render or pass it back to another theme rendering function.

How to get a callback when a View becomes visible on the screen on Android

Is there a way to get a callback when a View appears/disappears on the screen?
I need this for analytics purposes - eg. I need to check how many times people saw a view versus how many times they clicked on it.
I can tell whether a view is on screen at a certain point in time but I'm wondering whether there is a callback for that.
Also note that I'm not interested when a View's state becomes VISIBLE and not even when a view gets rendered (because eg. in a ViewPager the Views of the second page are rendered before they actually appear on screen).
We did several workarounds for certain scenarios but I'd like to have something which is more generic. We need it in ListViews, GridViews, ScrollViews and ViewPagers and each one of them presents different challenges.
Does ViewTreeObserver.OnGlobalLayoutListener help? I have never used it myself though.
See: http://developer.android.com/reference/android/view/ViewTreeObserver.OnGlobalLayoutListener.html

CollapseAll with one document causes no text to display

I have some categorized views on individual xpages. I have a button on the page which can collapse the views.
var viewPanel:com.ibm.xsp.component.xp.XspViewPanel = getComponent("viewPanel1");
try {
viewPanel.gotoFirstPage();
}
catch (e) {
}
var model = viewPanel.getDataModel();
model.getDominoViewDataContainer().collapseAll();
If there is only one document in the view and the view is collapsed, then no text is displayed in the view. Is anyone else seeing this behavior?
I can't tell you the grief this one caused me. I never suspected in would be the collapse that was causing the document not to display.
Clarification: The column titles are displayed. It is that the document is not displayed when collapse all is used. Also it looks it looks like no documents are being displayed after collapse all even when there are more than one document. View in notes client displays fine.
Figured this one out. It seemed to be multiple issues.
I had a computed field in the first column, of the actual view, to show the count. View Panel does not seem to like this. I moved the "count" column to the right beyond the categorized fields.
Some of the views seemed to have a problem wih the programmatic column. I removed all of the $XX values and gave them my own name.
Ctrl-Shift-F9 in the client seemed to fix remaining issues with other views.
I am seeing the same thing when using 8.5.3 server, but a replica on Domino 9 does not appear to exhibit this behaviour. I haven't been able to determine other cause yet, but appreciate some of the items you described.

Kentico CMSListMenu not displaying enough levels of the tree?

I have a kentico CMSListMenu which contains 4 levels at it deepest, i want to display the menu as a nested list down the left hand side of my content, this works fine for 3 levels but i cant get the 4th level to display.
I have this working on another site using the exact same code so i must be missing something, these are the menu expressions i have tried using:
<cc1:CMSListMenu ID="CMSTreeMenu1" runat="server" Path="/{0}/{1}/{2}/%" DisplayHighlightedItemAsLink="True" DisplayOnlySelectedPath="true" Indentation="0" MaxRelativeLevel="5" /></cc1:cmslistmenu>
<cc1:CMSListMenu ID="CMSTreeMenu1" runat="server" Path="/Products---Solutions/%" DisplayHighlightedItemAsLink="True" DisplayOnlySelectedPath="true" Indentation="0" MaxRelativeLevel="5" /></cc1:cmslistmenu>
do i need to set this somewhere else? perhaps somewhere inside of kentico to output so many levels down?
Any help would be greatly appreciated, this has been causing me problems for days
I believe that the CMS List Menu only displays cms.Page (Menu Item) documents by default. If you're trying to display other types of documents, make sure you set that in the menu properties.
Try setting DisplayOnlySelectedPath="false" to see if it displays everything as you expect it to under the menu.

Resources