Publicado Fri, 14 Feb 2020 21:55:43 GMT por Jon Weston File IT Solutions Sr Application Developer and RIM specialist
There is a code sample in the knowledgebase that shows how to write to a table column using a c# web service here (code sample) but I just need to iterate through the rows of a table and read the values from the Amount column.  Does anyone have some sample code to do that?
Publicado Fri, 14 Feb 2020 22:40:16 GMT por Joe Kaufman Bell Laboratories Inc No longer there
Jon,

First off, do you have access to the underlying database? It is always easier to query the index data directly if that is the case.

If you don;t have access to the database, then you need to get back document information one of two ways: 1) Pull down all documents in a file cabinet, or 2) Execute a query via the SDK to get a list of documents back. When you get a "Document" object back it isn't the actual document, but the record representing the indexes for the document (which is what you need).

This describes how you get all documents from a document tray or file cabinet:

https://developer.docuware.com/dotNet_CodeExamples/f9a6a984-57a9-42e9-8d26-1dd35611cf47.html

and this explains how to execute a query:

https://developer.docuware.com/dotNet_CodeExamples/b8b6ddf4-fee5-4b5c-84cc-046895c8aa5a.html

Note that the data you get back from this is not as easy to parse as, say, a relational database table. But you can parse the returned documents using loops and things like LINQ to pluck out the information you need.

Like I said, accessing the data directly is much more straightforward, so if that is an option, forego the SDK and hit the table directly. Just don;t do any modifications via that methodology.

Thanks,
Joe Kaufman
Publicado Fri, 14 Feb 2020 23:02:46 GMT por Jon Weston File IT Solutions Sr Application Developer and RIM specialist
Hi Joe,

I've accessed DW documents using the SDK before so I'm ok with that part of it, but as for the rest I think you've got the best idea: forego the SDK hit the tables directly with a SQL query.  Thanks and have a great weekend!
Publicado Mon, 17 Feb 2020 10:23:24 GMT por Simon H. Hellmann Toshiba Tec Germany Imaging Systems GmbH IT-Consultant Document Management Solutions
Hi Jon,

you can find the table field with the sdk and loop through all columns and rows within it to get the value you need.
See my example in C#:
string TableFieldName = "myTableField";
Document document = conn.GetFromDocumentForDocumentAsync(docID, fileCabinet.Id).Result;
List<DocumentIndexField> fields = document.Fields;
DocumentIndexFieldTable table = fields.First(f => f.FieldLabel == TableFieldName).Item as DocumentIndexFieldTable;
int rowCount = table.Row.Count();
for (int i = 0; i < rowCount; i++)
            {
                // iterates through all table field columns
                for (int j = 0; j < table.Row[i].ColumnValue.Count(); j++)
                {
                    string currentFieldName = table.Row[i].ColumnValue[j].FieldName;
                    string itemAsString = ToStringNullSafe(table.Row[i].ColumnValue[j].Item);
                    // do more stuff with the data
                }
            }

Hope this helps.

Greetings from Germany,
Simon H. Hellmann
DocuWare System Consultant
Publicado Tue, 18 Feb 2020 17:55:37 GMT por Jon Weston File IT Solutions Sr Application Developer and RIM specialist
well-commented sample code! thanks, Simon :)

You must be signed in to post in this forum.