Obtaining record count from dme query

 5 Replies
 0 Subscribed to this topic
 12 Subscribed to this forum
Sort:
Author
Messages
ryan
New Member Send Private Message
Posts: 0
New Member

I'm using Design Studio 9 and in my Design Studio User Guide 9 I see this but i can not get the Count to display on a portal page or find this option in the dme builder.

From guide:

Count (MAXOUT attribute or

RECORDS node)

If selected, provides a count of

records that resulted from the query.

Does anyone know how to capture the record count and display it? 

Ex: /servlet/Router/Data/Erp?PROD=TEST&FILE=EMPLOYEE&FIELD=EMPLOYEE;EMP-STATUS;PROCESS-LEVEL;&MAX=55&INDEX=EMPSET2&KEY=155=ABC123==&XCOLS=TRUE&XKEYS=TRUE&XRELS=TRUE&XCOUNT=TRUE&XIDA=TRUE&OUT=XML

John Henley
Send Private Message
Posts: 3351

In order to access that record count, you will need to examine the returned XML DOM using Javascript, something like this (assuming objDme is your Data/DME object):
var count = objDme.getElementsByTagName("RECORDS")[0].getAttribute("count")

Thanks for using the LawsonGuru.com forums!
John
David Williams
Veteran Member Send Private Message
Posts: 1127
Veteran Member
Here's a DME call I did that returns the record count:

var fieldName= "EMPLOYEE";
var vProd = portalWnd.oUserProfile.getAttribute("productline");
var vDmeString = "?PROD=" + vProd + "&FILE=EMPLOYEE&INDEX=EMPSET4&KEY=1000=" + fica + "&FIELD=EMPLOYEE;DATE-HIRED&OUT=XML";
var vDMEInfo = portalWnd.httpRequest(top.DMEPath + vDmeString);
var vObjDMEXML = new top.DataStorage(vDMEInfo);
var vRecords = vObjDMEXML.document.getElementsByTagName("RECORD");
David Williams
ryan
New Member Send Private Message
Posts: 0
New Member

I will try this and report back what I get to work.  Thanks!

ryan
New Member Send Private Message
Posts: 0
New Member
David,
What are you passing to your + fica + value in your query when it runs the query?
Is the "EMPLOYEE" fieldname coming later in the dme and are you using it later in the script?
David Williams
Veteran Member Send Private Message
Posts: 1127
Veteran Member
I don't actually remember where I got this from... but I'm sure the fica value was from a field on the form I was playing on.
David Williams