Subscribe to this thread
Home - General / All posts - programming : how to get number of records in a table ?

1,932 post(s)
#08-May-20 21:08

So, no question is too simple...

I read the object model and found no way to obtain the number of objects in a table. That should be easy to find.

How can I do that ? Do I have to use a "Sequence" ?

Shouldn't it be a propertie of a table in the meta table ?

Maybe I have to run a query for that ? That would make sense with what Tim was explaining here :

Thank you.


1,932 post(s)
#08-May-20 21:54

I wrote the begining :

function Main()


var app = Manifold.Application;

var  db = app.GetDatabaseRoot();

var query1 =  "SELECT Count([ID]) as [num] from [Lines]"

var table = Manifold.CreateTable;

table =  db.Run(query1);

var sequence  = Manifold.Sequence;

sequence = table.Search("mfd_id_x", 0, "num") // not sure


I don't understand how Sequence is working. How can I get the only data returned by the query ("num" value of first record) ? I don't really understand the second argument either. Why would I provide a key value ? Maybe I'm using the wrong path.

That looks like a lot of code to equal "Query.Table.RecordSet.Count".


9,552 post(s)
#09-May-20 08:59

A sequence reads record values from a table. The table returned by your statement contains a single record with a single value. To read it, use Table.SearchAll, not Table.Search (Table.Search searches for a record with specific values in fields, see the documentation).

Here's a corrected version of the script (important - use JScript.NET, not Javascript):

// JScript.NET


class Script



static var Manifold: Manifold.Context;

static function Main()


  var app = Manifold.Application;

  var db = app.GetDatabaseRoot();


  // run query

  var table = db.Run("SELECT Count(*) AS c FROM [mfd_root];");


  // retrieve results

  var fields = new String[1];

  fields[0] = 'c';

  var sequence = table.SearchAll(fields);

  if (!sequence.Fetch()) // read one record


  var values = sequence.GetValues(); // all returned fields

  var count = values[0].Data; // first field value







We agree this looks complex, but as a pro, this same workflow handles tons of different scenarios.

Currently, we are concentrating on mainly implementing object model calls that cannot be done efficiently using already existing calls, leaving implementing quality of life functions like counting the number of records in a table to the script writer / community. In the future we will provide our own utility functions as well.

We have tons of script examples in the API documentation, they are in C# / VB.NET / Python, but perhaps still useful for understanding how things are tied together.


1,932 post(s)
#09-May-20 13:06

(important - use JScript.NET, not Javascript):

Why ? It is a language available when creating a script isn't ?

We have tons of script examples in the API documentation, they are in C# / VB.NET / Python, but perhaps still useful for understanding how things are tied together.

I can read these 3 languages and understand them. However, I think examples are far too complex to understand the basics of the object model. Basics purposes examples are missing. The one you wrote in the previous post is a good example of what is missing.

I use Manifold for years and program with 8 almost every business day. The fact that I cannot understand programming in 9 should be a concern for Manifold team. Something is missing. As a customer, I feel like having been let down. Explanations necessary for a beginner are not available. I can program in C# if needed, but if I cannot understand the model and connect the dots, I cannot program anything.

At this moment, it's like I want to go somewhere, but there is no map to get me there.


9,552 post(s)
#09-May-20 16:28

Javascript uses the V8 engine, and a specialized object model which is much less developed than the COM / .NET one (we are mainly using it currently for internal scenarios, this is going to change when we add support for serving maps over the web).

JScript / JScript.NET use COM / .NET and the regular object model described in the API documentation.

Regarding making sense of the objects - the API documentation includes the Overview section which specifically describes how different objects interact with each other, the big picture. If you didn't yet read it, do so.


700 post(s)
#09-May-20 23:55

Does manifold 9 support now JavaScript library ?

Does the library should be locate inside or outside *. map file ?

Does Nodeis is supported ?

I think manifold is and ll stay Microsoft oriented and use a language without debugger and efficient editor (.

Vim like editor comeback under the name of VStudio Code, bracket) is a waste of time ( time is money and pro ll buy VStudio ).

I really ask myself how people can write so long SQL code , Does it mean that Manifold SQL editor is efficient ? ..( help locate line where error occur) or people understand master SQL rules syntax API....?.....



9,552 post(s)
#10-May-20 09:17

You can use Javascript libraries that do not depend on browser DOM. Using a library currently requires copying it into the script. We will add means for one script to include a different script or - which would be more familiar for Javascript in particular - to include a library via a URL.

Here is an example of using a pre-existing Javascript library in a Manifold script:

Accessing turf.js functions in queries

People who write long queries can do so because they spent a lot of time practicing. We do have some facilities that help - ie, there are query constructs which help keep even big queries clean and understandable, there is a query builder which lists every construct and every function with parameters and options, the text editor includes various helpful commands, the command window allows running individual statements and inspecting intermediate results, etc. We can do better with error diagnostics though - that's being worked on.


700 post(s)
#12-May-20 00:10


As a web developper ( do custom CMS by change css php js code ) , there is too many way for loading external library when we are on server side ( nodejs ) or client side ( browser) and this need to use external library .But in manifold software i really don't know how it works ( already discuss here) . I already test compile debug with Typescript ( create by microsoft use by also by google ) that help achieve loading external library more easely and do things better ( manage library) .

Do i write something wrong by writing that but :

1) Does the only library that javascript support in manifold is the manifold library itlself and by default the libraries include with the javascript engine ?


2) Does the javascript support the javascript use in manifold target the Universal Windows Platform (UWP) ? so since use a browser mean have a embedding console and debugger plugin . Does have manifold with javascript mean we can copy paste the hello world UWP code find inside the bracket of sayHello(){ code } ? UWP need support of .NET Core 5 ( in 2019 refer to the link)

When use python ( not iron python) i remember i could have acces to a python UI library I choose to install ( don't remenber if it was QT or GTK or another one but gui appear in manifold 8 with event support ) . So I ask mylself if the process of installing external javascript library ( DOM , CSS , nodejs, UI to be use in manifold 9 javascript ) is not too cumbersome. I ll test the link you give ...thank's.

Now that Microsoft Edge Browser is base on chromium .... The choice of include V8 (inside manifold 9 ) was the same since since Edge79 . My edge version is now 81.0



Photoshop has also a javascript library that need to use it own IDE not integrate inside photoshop. So not really user friendly when see Android IDE (yes use java and really great javadoc style ) !

. I read a comment about JScript=Javascript but why not a JScript.NET =Javascript .NET that support and enhance the Javascript EMACS syntax/engine but with access to wonderfull Microsoft library ( .COM or.NET FRAMEWORK 4.6 or newer .NET CORE 4.5 )

many web editor like atom bracket use Chromium code/API ( user interface) but UWP is not chromium compatible ? A Chromium-based Edge doesn’t signal the end of life for those UWPEdgeHTML controls

Does UWP is COM or .NET compatible or is another planet ?

UWP WebView is using EdgeHTML to render content. will this be replaced with Microsoft Edge(Chromium) with 20H1 release?

NB need to re install manifold to test by myselft ( TODO list )




700 post(s)
#12-May-20 00:25





700 post(s)
#14-May-20 06:15

OS update -> .................OS 1909.18363.836

Windows 10 Pro 19H2 Will be 1909.18363.836

Windows 10 Pro 20H1 Will be 1909. ? ( not today)




9,552 post(s)
#14-May-20 09:33

This is a fairly big update for Windows 10 coming down the line soon indeed.

For me personally, the most interesting thing in the update is the next version of the Windows Subsystem for Linux - because this may affect development in interesting ways. But there are plenty of small niceties of general appeal - the GPU temperature readout, built-in support for IP cameras, etc. (Also: "drag and drop with your eyes"? Would love to see how that works in practice.)

One thing missing is the new version of Edge based on Chromium. That was in the beta for a long time now and I for one am eagerly awaiting the moment this lands on Windows Update, and will certainly try it out - it might end up being a better Chrome than Chrome itself, so to speak.


Also, to answer an earlier question: UWP (or, perhaps more accurately, WinRT) is COM with additional requirements, but programming WinRT using plain COM interfaces is a little hard so there are various helper technologies. For .NET languages there is a layer which makes WinRT objects look like .NET objects, it works pretty seamlessly. For C++ there was a language extension at first - C++/CX, which few people liked, then a library-like layer which wraps WinRT objects into C++ ones. The main problem with WinRT is that not only this is a parallel API to, say, Win32, but you also have to choose whether you are using one or the other, you cannot generally use both. So, you are either staying on the old API or you are switching over to the new API entirely. This is a very difficult jump, so the number of applications using WinRT is much smaller than it would have been were it not for this requirement. Recently, it started becoming possible to use some of WinRT from "old"-style applications, but only parts. It's a big mess. Frequent with software. :-)

454 post(s)
#15-May-20 00:49

The Chromium build of edge was released in January, if you don't want to await Windows Update.


9,552 post(s)
#19-Jun-20 11:12

I cannot resist posting a follow up on this.

The new Edge still does not seem to be in the Windows Update even now and it wasn't there a month ago either, so I bit the bullet and installed it manually shortly after this thread. I've been using it for a month instead of Chrome. I have no regrets whatsoever.

The biggest things I hated about Chrome was the enormous bundling of all Google services with what must have been a mere browser (they have their own antivirus tool, for god's sake, and yes, that tool scans much more than just the Chrome area and spends a lot of time doing that, you can turn it off but that's a constant game of clearing several hundred 'on/off' options which change as Chrome updates itself) and a very aggressive capture of system resources.

The new Edge solves both of these problems. It removes most of the bundled services, some of which were duplicating what the operating system was doing anyway:

(The above slide is part of an earlier presentation for Edge linked on twitter.)

The new Edge is also much more conservative as regards system resources - no more launching a separate *process* for each CPU just in case you might need it later and no similar stuff. Unlike Chrome that seems to think that the computer exists solely in order to launch Chrome and browse the web, Edge accepts that the browser might be just one of the multiple applications running and that people sometimes do things other than read news / ads and watch Youtube videos.

I am absolutely in love with the new Edge, this is the best thing Microsoft did in ages. The only thing I had to add was an ad blocker - we here in the office tend to use uBlock Origin and it works just fine. Happy. :-)


700 post(s)
#07-Apr-21 12:49

Discover today a strange behaviour discuss in some forum:w hen you use window 10 and login with a Microsoft account ( not local user) then when launch Edge chromium browser that "don't use " UAC...then you are connected in a implicit way and in a automatic way to your microsoft account. Thus you can use all the microsoft services like office 360 xbox and win points when use Bing search engine ( reward redeem goal to reach amount of points and subscribe to one month or 3 to game pass for example )......

Microsoft and google...all others ( apple CB) same bussiness when speak about privacy. OS ( android) and Browser (prople work) can't be free.... even Brave that "pay" you to share your url history !!!



700 post(s)
#15-May-20 11:31

Even don't code , i was thinking that xaml and silverlight 'll be the future feature but Microsoft make me thing of adobe and serif.Adobe continue to enhance their software but more and more buggy slow, make up. Serif choose to be the future that take the look and feel of Adobe but start from nothing. I think beOS try to do this to replace Mac OS ( unix based) and Microsoft ( SFX project).it is the way manifold go for their software since the first GUI and continue today to go to the hard risky way to start from nothing beginning by the core : the engine/ library (radian) and then build the UI.

Android is another story because " free" and android without Google services ( application library web service) is like use mono without some Microsoft framework.Huawei ll have Huawei services and more and more playstore alternative exist (base on Google services? Don't test , don't buy a android without Google services)

When technology ll be mature, why not go to .NET CORE by changing in the compile option only the target platform !!

Now I don't test believe in Microsoft evangelist...perhaps test and see and stay on technology that is efficient and be test by millions of users. Microsoft seem to create only to show that they are here ( duplicate technology but proprietary build that use their own tool technology) . The Microsoft illustrator clone was a toy never begin or finish....silverlight and flash don't live a lot. Open office functionalities ll kill office , open OS ( Linux) ll kill apple and Microsoft ....JavaScript is now in all the browsers not because it is a wonderfull programming language only because it give Netscape a way to have interactivity and it was free like C programing language. JavaScript is nice because you don't need an ide to compile and test it . All is available in the browser in console mode and you can call use all the library you want if accessible on the web ( a HTML tag ll load the library for you even you can by script call it when you ll need it).

I am Shure a very few people among manifold users use JavaScript. Perhaps it ll be different when IMS ll be implemented..but web is another world. Developper was a kind of web designer using form designer and now has helpers like bootstrap and jQuery UI

But who use asp gis server or SharePoint server today ?

Best Price or free things drive technology..choice.

All iiI speak here is not about GIS but howto be more efficient ( programming ) and show/share result ( web not office/pdf)..



9,552 post(s)
#15-May-20 15:01

Two things:

Why not go .NET Core - we will likely do this for scripts eventually. There's no rush because .NET Framework simply has more than .NET Core has. A lot of the modules in .NET Framework are Windows-specific and aren't part of .NET Core. .NET Core is still trying to port some of the most important ones. .NET Core does have features that .NET Framework doesn't have, but they aren't terribly big compared to what it is missing, although obviously it all depends on the scenarios.

Javascript is only popular because it is everywhere - that's probably true, and it is also true that Javascript contains a lot of unintuitive stuff which works the way it does because that's how it evolved. But Javascript also has a very good thing going for it - its dynamic nature, if aided by the object model, makes scripts very short and readable. This, plus the availability of a huge number of libraries, which save time coding, and a big roster of third-party development tools, which help with various aspects of development, make Javascript pretty attractive.


9,552 post(s)
#12-May-20 11:48

Scripts in COM / .NET languages such as VBScript, VB.NET, C#, JScript, JScript.NET, etc, have access to the Manifold COM / .NET object model. COM scripts can use functionality in external COM objects (a little old-style, but Windows still comes with various utility objects that expose the COM interface installed). .NET scripts can use functionality in external COM objects plus in .NET assemblies. One of the ways to call functions in a .NET assembly is to add a $reference$ directive into the comments at the top of the script: example script. The .NET we use is .NET Framework, not .NET Core.

Scripts in Javascript have access to the Manifold V8 object model. In addition, you can use the objects and methods described in the Javascript standard. All other libraries, typically used via SCRIPT HREF on the web, currently have to be copy / pasted into the script code.


1,932 post(s)
#12-May-20 13:43

Javascript uses the V8 engine

I cannot find any mention about that in the API doc.

Overview section which specifically describes how different objects interact with each other, the big picture

That's what is needed : a picture. It worth thousand words and greatly helps to view things differently.

Document in 8 was very sharp, precise, complete, fast to use, graphical. Getting the picture was easy.


9,552 post(s)
#12-May-20 14:08

We agree the distinction between .NET / COM scripts and V8 should be more apparent, we'll work on that, otherwise the choice of 'Javascript' opposite to all other choices is somewhat of a trap.

The API doc does not mention V8 because it's for the .NET / COM object model and V8 is not that. We will add the API doc for the V8 object model after we bring that object model up to speed - this is part of the map server functionality.

We'll think about including more pictures into the API documentation as well.


1,932 post(s)
#14-May-20 13:21

As Javascript is not equal to all other languages offered in the dropdown list when creating a script, maybe it should have an "*" after is name and a note below listing its limitations.


9,552 post(s)
#14-May-20 15:37

Altering the name and / or adding some descriptive text is a good idea. Thanks, we'll consider it.

Manifold User Community Use Agreement Copyright (C) 2007-2019 Manifold Software Limited. All rights reserved.