locked
How to get the vocabulary on iOS RRS feed

  • Question

  • How do I get all the items of vocabulary for medication-dose-units in iOS?
    Tuesday, March 25, 2014 2:01 PM

Answers

  • You can use HVGetVocabTask class to get all the items of vocabulary. For example:

    HVVocabCodeSet *m_vocabFound;

    HVGetVocabTask *vocabTask = [[HVGetVocabTask alloc] initWithCallback:^(HVTask *task) {
            if(!task.hasError)
            {
                m_vocabFound = ((HVGetVocabTask *) task).vocabulary;
            }
        }];

    vocabTask.params = [[HVVocabParams alloc] initWithVocabID:[HVMedication vocabForDoseUnits]];
    [vocabTask start];

    In the above example m_vocabFound HVVocabCodeSet object will contain all the items.

    If you do not want to download the entire vocab from HealthVault, you can search for a specific item in a vocabulary by using HVSearchVocab task. This way you only get items you want instead of getting the full vocabulary. For example

    HVVocabSearchTask *vocabTask = [[HVVocabSearchTask alloc] initWithVocab:[HVMedication vocabForDoseUnits] searchText:searchString andCallback:^(HVTask *task) {
            if(!task.hasError)
            {
                m_vocabFound = ((HVVocabSearchTask *)task).searchResult;
            }
        }];
       
        HVVocabSearchText *searchText = [[HVVocabSearchText alloc] initWith:searchString];
        searchText.matchType = HVVocabMatchTypePrefix;
       
        HVVocabSearchParams *params = [[HVVocabSearchParams alloc] init];
        params.text = searchText;
        vocabTask.params = params;
       
        [vocabTask start];

    You can use different match types like Full Text, Prefix. <o:p></o:p>


    Tuesday, April 1, 2014 8:36 PM