Skip to main content
edited tags
Link
Bart Koopman
  • 29.6k
  • 3
  • 40
  • 90
Tweeted twitter.com/#!/StackTridion/status/461213732052664321
added 43 characters in body
Source Link
Ant P
  • 2k
  • 16
  • 27

I have three Schema A (Content) , B(Embedded), C(Embedded)

Schema A have fields A1(text) and A2(EmbeddedSchema)

Schema B have fields B1(EmbeddedSchema), B2(text) And Schema C have fields C1(text) and C2(text)

Schema B is embedded with field A2 and Schema C is embedded with field B1.

How to get the value of C1 field in C# TBB/Fragment.

I am doing to get the value of field A2 (document_order) with below code but unable to get the in field C1

if (pubMetadata.Contains("order_sort")) {
{    
    foreach (ItemFields docsort in ((EmbeddedSchemaField)pubMetadata["order_sort"]).Values) 
    {
        //Below code line works  
       //Below codestring linedocOrder works= ((KeywordField)docsort["document_order"])
                   string docOrder= ((KeywordField)docsort["document_order"])         .Value.Description.ToString();
           
        //Below code line is not working 
        string docSortName = ((KeywordField)docsort["doc_sort"])
        string docSortName= ((KeywordField)docsort["doc_sort"]).Value.Description.ToString();
                
        .Value.Description.ToString();                    
    }

}

I have three Schema A (Content) , B(Embedded), C(Embedded)

Schema A have fields A1(text) and A2(EmbeddedSchema)

Schema B have fields B1(EmbeddedSchema), B2(text) And Schema C have fields C1(text) and C2(text)

Schema B is embedded with field A2 and Schema C is embedded with field B1.

How to get the value of C1 field in C# TBB/Fragment.

I am doing to get the value of field A2 (document_order) with below code but unable to get the in field C1

if (pubMetadata.Contains("order_sort")) {

foreach (ItemFields docsort in ((EmbeddedSchemaField)pubMetadata["order_sort"]).Values)  {
                   //Below code line works 
                   string docOrder= ((KeywordField)docsort["document_order"]).Value.Description.ToString();
                  //Below code line is not working 
                   string docSortName= ((KeywordField)docsort["doc_sort"]).Value.Description.ToString();
                
                       }

}

I have three Schema A (Content) , B(Embedded), C(Embedded)

Schema A have fields A1(text) and A2(EmbeddedSchema)

Schema B have fields B1(EmbeddedSchema), B2(text) And Schema C have fields C1(text) and C2(text)

Schema B is embedded with field A2 and Schema C is embedded with field B1.

How to get the value of C1 field in C# TBB/Fragment.

I am doing to get the value of field A2 (document_order) with below code but unable to get the in field C1

if (pubMetadata.Contains("order_sort"))
{    
    foreach (ItemFields docsort in ((EmbeddedSchemaField)pubMetadata["order_sort"]).Values) 
    {
        //Below code line works  
        string docOrder = ((KeywordField)docsort["document_order"])
                              .Value.Description.ToString();
 
        //Below code line is not working 
        string docSortName = ((KeywordField)docsort["doc_sort"])
                                 .Value.Description.ToString();                    
    }

}
Source Link
user584
  • 1.1k
  • 5
  • 10

How to access the nested Embedded Schema fieldsin C# Fragement

I have three Schema A (Content) , B(Embedded), C(Embedded)

Schema A have fields A1(text) and A2(EmbeddedSchema)

Schema B have fields B1(EmbeddedSchema), B2(text) And Schema C have fields C1(text) and C2(text)

Schema B is embedded with field A2 and Schema C is embedded with field B1.

How to get the value of C1 field in C# TBB/Fragment.

I am doing to get the value of field A2 (document_order) with below code but unable to get the in field C1

if (pubMetadata.Contains("order_sort")) {

foreach (ItemFields docsort in ((EmbeddedSchemaField)pubMetadata["order_sort"]).Values)  {
                   //Below code line works 
                   string docOrder= ((KeywordField)docsort["document_order"]).Value.Description.ToString();
                  //Below code line is not working 
                   string docSortName= ((KeywordField)docsort["doc_sort"]).Value.Description.ToString();
                
                      }

}