I am trying to retieve all the available values from a list field on a document using Repository Accesss, in LF 9.
Any C# sample code would be much appreciated.
I am trying to retieve all the available values from a list field on a document using Repository Accesss, in LF 9.
Any C# sample code would be much appreciated.
FieldInfo listField = Field.GetInfo("My List Field", mySession); foreach (string listItem in listField.GetItemList()) { // TODO }
This is code snippet about how to get items within a field of list type.
I am not sure about using Repository Access but I have an example from a recent script that does this using LFSO. This example populates a multi-value token with all the items in a list field.
LFTemplate myTemplate = (LFTemplate)db.GetTemplateByName("My Template"); LFTemplateField myField = (LFTemplateField)myTemplate.ItemByName["My Field"]; for (int i = 1; i <= fType.Count; i++) { this.SetTokenValue("Multi Value Token", myField.Item[i]); }
Thanks for the reply. Unfortunately my project is based on Repository Access, and while I can mix LFSO90 in the project, there does not seem to be a way that LFSO90 can share the connection established by RA, which uses a Session object for its connections -- LFSO90 uses LFConnection or the standard LFDatabase object. So I would need to establish 2 connections at a time - one for RA and another for LFSO90.
So it has to be in RA, and there doesn't seem to be help in the help files. Admittedly, I have been focusing on the document level -- I see your approach is based on interrogating the Template, I will give that a try in RA and see. But if anyone has accomplished this in RA, please can you assist with some sample code.
Thanks, I'll give it a try!