0

Summary: I'm trying to write a script that will pull through a candidates "answer" based off of of a "question code", and have it only pull one row of data per candidate.

Problems:

  1. The "answer" field brings through the answers to multiple questions (which in turn brings multiple rows; 1 for each question/answer), and I only care about bringing through the answer to the one question.
  2. If I filter the entire script off of the question code (DQ_009), it will only pull through candidates that have answered the question and it does not pull through candidates that have not answered it.
  3. I'm not a developer/code writer by trade. I'm being asked to do this because no one else has any idea what's going on.

What I'm looking for: I'm trying to figure out possibly how to use a complex projection or a subquery (or something else, I'm not sure the right approach) within TCC that will only bring through the answer to that specific question, but also bring it through for people that have not answered it (leaving it blank though).

Code explanation:

  1. In the code I have provided, I copied and pasted this from the "source" of the script. I have it filtering on the candidate number of 36620, which is a candidate that has not answered the question, and thus is not pulling through a value.
  2. I'm trying to have it only pull through the value for the "Question" section when it equals "DQ_009"(which ends up being 'Yes', 'No', or if the candidate has not answered the question, and thus does not exist, I want it to just be blank so it still pulls a row of data for them).

Any help is extremely appreciated.

<quer:query productCode="RC1704" model="http://www.taleo.com/ws/tee800/2009/01" projectedClass="Profile" locale="en" mode="CSV" csvheader="true" largegraph="true" preventDuplicates="false" xmlns:quer="http://www.taleo.com/ws/integration/query">
  <quer:subQueries/>
  <quer:projections>
    <quer:projection alias="Candidate_ID">
      <quer:field path="ProfileInformation,Candidate,Number"/>
    </quer:projection>
    <quer:projection alias="Visa_Needed">
      <quer:field path="ProfileInformation,Candidate,QuestionAnswers,Answer,Description"/>
    </quer:projection>
    <quer:projection alias="Question">
      <quer:field path="ProfileInformation,Candidate,QuestionAnswers,Question,Code"/>
    </quer:projection>
  </quer:projections>
  <quer:projectionFilterings/>
  <quer:filterings>
    <quer:filtering>
      <quer:equal>
        <quer:field path="ProfileInformation,Candidate,Number"/>
        <quer:long>36620</quer:long>
      </quer:equal>
    </quer:filtering>
  </quer:filterings>
  <quer:sortings/>
  <quer:sortingFilterings/>
  <quer:groupings/>
  <quer:joinings/>
</quer:query>
DRock
  • 1

1 Answers1

0

Here is a way to do it using a complex projection. Note that I modified your query to start from the "Candidate" entity instead of "Profile" to shorten the field paths.

With the complex projection you can modify the filters of the main query to also extract candidates that did not answer to the question.

<?xml version="1.0" encoding="UTF-8"?>
<quer:query productCode="RC1704" model="http://www.taleo.com/ws/tee800/2009/01" projectedClass="Candidate" locale="en" alias="MainQuery" mode="CSV" csvheader="true" largegraph="true" preventDuplicates="false" xmlns:quer="http://www.taleo.com/ws/integration/query">
    <quer:subQueries/>
    <quer:projections>
        <quer:projection alias="Candidate_ID">
            <quer:field path="Number"/>
        </quer:projection>
        <quer:projection alias="Visa_Needed">
            <quer:query projectedClass="Candidate" alias="VisaAnswer">
                <quer:projections>
                    <quer:projection alias="AnswerDesc">
                        <quer:field path="QuestionAnswers,Answer,Description"/>
                    </quer:projection>
                </quer:projections>
                <quer:filterings>
                    <quer:filtering>
                        <quer:equal>
                            <quer:field path="QuestionAnswers,Question,Code"/>
                            <quer:string>DQ_009</quer:string>
                        </quer:equal>
                    </quer:filtering>
                    <quer:filtering>
                        <quer:equal>
                            <quer:field path="Number"/>
                            <quer:field ownerQuery="MainQuery" path="Number"/>
                        </quer:equal>
                    </quer:filtering>
                </quer:filterings>
            </quer:query>
        </quer:projection>
    </quer:projections>
    <quer:projectionFilterings/>
    <quer:filterings>
        <quer:filtering>
            <quer:equal>
                <quer:field path="Number"/>
                <quer:long>36620</quer:long>
            </quer:equal>
        </quer:filtering>
    </quer:filterings>
    <quer:sortings/>
    <quer:sortingFilterings/>
    <quer:groupings/>
    <quer:joinings/>
</quer:query>
StefB
  • 131
  • 3