简体   繁体   中英

Export questionnaire(KMQuestionnaireRun) results to XML

How can I access the results of a questionnaire/s (KMQuestionnaireRun type) of a client to export the results to an XML dynamically.

A sample of the class that I am working on:

while select rmlSomaticMeasures
            outer join rmlSomatometryWorker
                where rmlSomatometryWorker.RMLRef == rmlTable.RecId
                && rmlSomatometryWorker.SomaticMeasureId == rmlSomaticMeasures.SomaticMeasureId
        {
            if (rmlSomatometryWorker.Value)
            {
                nodeMeasure = doc.createElement(strReplace(strUpr(rmlSomaticMeasures.SomaticMeasureId)," ","_"));//.text(strReplace(strUpr(rmlPhysiologicalHabitWorker.Value)," ","_"));
                nodeMeasure.text(strReplace(Num2Str(rmlSomatometryWorker.Value,0,5,1,0)," ",""));
                nodeSOMATOMETRIA.appendChild(nodeMeasure);
            }
            else
            {
                nodeMeasure = doc.createElement(strReplace(strUpr(rmlSomaticMeasures.SomaticMeasureId)," ","_"));
                nodeSOMATOMETRIA.appendChild(nodeMeasure);
            }
        }

Short answer , aka "The fish"

The results are stored in tables KMVirtualNetworkAnswerTable and KMVirtualNetworkAnswerLine

Long answer , aka "Let me tell you how to fish":

You already figured out that each time a questionnaire is done, it is processed by one of the subclasses of abstract class KMQuestionnaireRun . When I did one of the questionnaires in Contoso, I noticed that afterwards a little message pops up "The completed questionnaire has been saved". I figured that is a good place to start, so I jumped to the code line that produces that message (just select the message in the infolog and click "Edit"). This brought me to class KMQuestionnaireSave , method save (which is called by method close in class KMQuestionnaireRun ). From there it is fairly easy to navigate to class KMQuestionnaireSaveResult , method saveAll and see how the above tables get written.

I figured this out in Version AX 2012 R2 CU7. I did not check other versions, but I would guess the data model to be similar or identical.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM