4

By using Custom Meta Query from TridionBroker database,

I want to retrieve KEY_STRING_VALUE from KEY_NAME or ITEM_ID .

I show the image below.

 "CUSTOM_META" Table of My TridionBroker database

i try in reference to seeing below url

getting key_string_value using content delivery api

but, i can't

so

Can i retrieve KEY_STRING_VALUE from KEY_NAME or ITEM_ID based on custom meta data ?

5

The custom metadata is present in the broker only to allow filtering and not as pure "model" data; as such the APIs do not provide you with a method to directly lookup this data via a normal API call (you can create filters based on custom meta to get components that have certain custom meta field values set).

THe "model" data that is exposed from the broker is the content of the relevant dynamic component presentation. The solution would therefore be to have the relevant metadata available in the rendered content of the component presentation (you can even have a dedicated CT for exposing this metadata so that your "normal" published content doesn't get polluted with this metadata).

Update: if the metadata values are metadata on a keyword and the taxonomy is published this post should explain how to retrieve metadata from published keywords. There should be no need to publish as DCPs instead.

In your case below code might work:

TaxonomyFactory taxonomyFactory = new TaxonomyFactory();
Keyword keyword = taxonomyFactory.GetTaxonomyKeyword("tcm:38-979-1024");
CustomMeta customMeta = keyword.KeywordMeta;
var theValue = customMeta.GetValue("case_icon");
  • Thank you answer my question. The solution is DCP. But this is keyword that have metadata. So the solution is that I change keyword that have metadata to component that have metadata. Is My understanding is right?? – Arai Yuhei Dec 12 '14 at 12:33
  • And I have one question. In reference to your answer, I think API don't know Content of DCP ,so API can't retrieve KEY_STRING_VALUE, don't you? I want to use retrieved KEY_STRING_VALUE to search by Tridion API – Arai Yuhei Dec 12 '14 at 12:51
  • I assume you already know ITEM_ID and KEY_NAME otherwise how would your solution work conceptually (even a direct database query wouldn't work). – Bjørn van Dommelen Dec 12 '14 at 14:33
  • Thank you to answer my question.in reference to seeing you sorce code , I cat retrieve. Thank you very much . – Arai Yuhei Dec 13 '14 at 6:22
0

my source code is below

        TaxonomyFactory taxonomyFactory1 = new TaxonomyFactory();
        Keyword item = taxonomyFactory1.getTaxonomyKeyword("tcm:22-1120-1024");
        CustomMeta customMeta = item.getKeywordMeta();

        if (customMeta.getNameValues().containsKey("news_icon"))
        {
            List<Object> array = new ArrayList<Object>();
            array = customMeta.getNameValues().get("news_icon").getMultipleValues();
            writer.println("fin1: " +array.get(0));
        }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.