You are viewing limited content. For full access, please sign in.

Question

Question

Getting Laserfiche field information for fields not tied to a particular template

SDK
asked on December 30, 2013

This is an API question: how do I get a list of fields that are not tied to templates. All the API documentation has examples for getting fields tied to templates. How do I access field definitions that are not tied to a template?

0 0

Answer

APPROVED ANSWER
replied on December 30, 2013

It sounds like you're looking to get the field values set on an entry. If you want all of the field values regardless of whether or not they're a part of a template, the EntryInfo object has a method called GetFieldValues.

 

If you need only the field values set on an entry that aren't a part of a template, you could test the results of GetFieldValues using FieldInfo's GetContainingTemplates, which returns a collection of the templates that contain the field in question.

 

More information about both EntryInfo and FieldInfo can be found in the "Laserfiche SDK 9.0" manual installed with the SDK under ".NET APU Object Reference".

1 0

Replies

replied on December 30, 2013

If you prefer LFSO, the SDK documentation mentions that you can set fields independently from the template by using their names and has examples of setting fields by name.

' Gets the document from the root folder.
Dim Doc As LFDocument = DB.GetEntryByPath("\Doc1")
' Gets the FieldData object for the document.
Dim DocMetaData As LFFieldData = Doc.FieldData
' Gets a field as a string, by name.
Dim sVal1 As String = Fields.FieldAsString("Number")
' Gets a field as a date object by name.
Dim oVal1 As System.DateTime = Fields.Field("Date")

' Locks the object for writing.
DocMetaData.LockObject(Lock_Type.LOCK_TYPE_WRITE)
' Defines new values for fields.
DocMetadata.Field("Document")= "12"
' Sends changes to server.
DocMetaData.Update()
' Unlocks the object and disposes of all handles.
Doc.Dispose() 

 

1 0
replied on June 3, 2014

We are a VAR.  Urgent assistance needed for a demo scheduled for tomorrow.  Our code which utilizes LFSO80 to inteface wtih LF9.0 to update template fields is incurring an exception at FieldData.Update() with this error: The parameter is out of range or too long.  Code has not changed in a long time and it used to work just fine.

0 0
replied on June 3, 2014

This usually means that you're trying to save a value longer than the maximum size of the field (for ex, a 10 character string into a 7 character field) or the wrong type of data for the field (a string into a number field).

0 0
replied on June 3, 2014

Check the value that you are updating the field with. Confirm that it falls within range of the field. Meaning, if it's a text field that you are updating, make sure the length of the value doesn't exceed the field width, etc.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.