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

Question

Question

How to retrieve list items from a list type field from a document using RA

SDK
asked on January 15, 2014

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.

 

0 0

Answer

APPROVED ANSWER
replied on January 16, 2014
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.

1 0

Replies

replied on January 15, 2014 Show version history

 

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]);


     }

 

1 0
replied on January 15, 2014

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.

0 0
replied on January 17, 2014

Thanks, I'll give it a try!

0 0
replied on January 28, 2014 Show version history

Works perfectly!  Thank you!

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

Sign in to reply to this post.