Views
It always creates confusion when the same word is used to describe different things. Ninox can create tabs at the top of the main window and these are called 'Views'. Then there is a layout type field called a 'View'. Brilliant.
While I appreciate they have similarities, they are factually different and trying to discuss either requires clarification of precisely which is being discussed - clarity so often missing in discussions on this forum and even in Ninox documentation where they state Views (apparently referring to big top tab Views) can show filtered data and if anyone knows how to actually filter the data shown in a big top tab View, please let me know as having to mess with a column's values and filters is quirky at best and inconsistent. Those Views need a simple way to filter the rows shown, not necessarily based on visible columns. Anyway…
I actually have a question about View fields.
Having created a small table of records to show on a form, I want to programatically count the number of rows displayed, to use that number elsewhere. However, it appears to be impossible to access a View field in any script anywhere as the View field is not listed for easy selection and typing the actual field name just produces en error that the field cannot be found.
Is there actually a clever way to make programmatic use of such a View field? In particular I need to know if it contains any rows but currently am completely stumped. Or are we denied any such access?
14 replies
-
Actually just figured out how to count the rows:-
Create a formula field that gathers the records. You can count() this.
Then create a view and make it equal to the formula field above.
Works but seems bit cludgy. Why can't I simply count() a View field?
-
I would throw out the idea that a view element does its one job very well, which is to show you the array of records that was discovered in the formula. So it is not just an array that you can count.
You can try: 1) creating a formula field, we will call it rawData, with the exact same formula as the view element. 2) Then in the view element formula put in rawData. 3) Now you can create another formula field that counts rawData. This way you only need to make 1 change and it will propagate to all your other formulas.
-
Another problem I find. To be clear again, I am referring to the 'View' field/element and not a top tab view.
When I programatically change something that is displayed in the View, only some of the rows show the change. Which rows update seems random, but importantly, the data being displayed is no longer correct.
Simply pressing the 'Refresh/Redraw' button top left of the main table immediately corrects this and everything is then displayed accurately. How can I do this programatically?
The only solution I can come up with is to include at the end of the script:-
closeRecord(); popupRecord(c)This works (c being previously set to 'this'), but causes a visual glitch as the popup closes and opens again, whereas it just needs to redraw. Obviously possible as there is the built-in button to do this, but we have no access to that.
Anyone suggest how best to force redraw in a script?
-
said:
I have a formula field that gathers records from another tableCould you post a copy of the code that is in this formula field.
Thanks John
-
Hi
It's worth a lot!
If this is in a formula field, which you say it is, then the problem lies with using a select command to gather the data. Select commands need a reason to run, which works in a button or trigger but in a formula field they don't always run (it would be detrimental if they did). I think it would need a change in the values of
Lightingⁿ'.'Lighting¹'or
'Model∆¹'to trigger it, but I'm not sure.
See if you can collect the data in another way, through a relationship maybe?
Regards John
Content aside
- yesterdayLast active
- 14Replies
- 68Views
-
3
Following
