Replace null values in Taleo-Connect-Client extract - taleo

I am extracting some values from Taleo via TCC export script and few rows in a column are blank, I want to replace the blank values with 'NULL' written.
For example
SignonBonus
1.20000
2.
3.30000
4.250000
How is this possible ?
I have tried the below code, I am writing Bonus amount in words so have used concatenate function. but this replaceNull logic is not working, can someone suggest ?
<quer:projection alias="BonusinWords">
<quer:concatenate>
<quer:switchByCriterion>
<quer:cases>
<quer:case>
<quer:replaceNull>
<quer:field path="CurrentOffer,SignOnBonus"/>
<quer:string>Null</quer:string>
</quer:replaceNull>
</quer:case>
<quer:case>
</quer:case>
</quer:cases>
</quer:switchByCriterion>
</quer:concatenate>
</quer:projection>
Thanks alot in advance
Shivam

I solved it on my own
I used a notnull equation in the starting, then wrote the below logic of query.
<quer:projection alias="BonusinWords">
<quer:switchByCriterion>
<quer:cases>
<quer:case>
<quer:notEqual>
<quer:field path="CurrentOffer,SignOnBonus"/>
<quer:string>1000000000000000000000</quer:string>
</quer:notEqual>
<quer:concatenate>
<!--Between this I wrote the logic for words!>
</quer:concatenate>
</quer:case>
</quer:cases>
</quer:switchByCriterion>
</quer:projection>
It is not exactly not null condition, but it is serving me since the bonus amount can never be this huge(or I can add more zero's in this), if you know how not null can be put in this I will try that also.
Thanks,
Shivam

Related

Is there way to customize col_max value without change python-click source code?

I'm facing a very concrete problem with python-click 8.1.3. The helptext created by Click wastes too much column space when an option name is a tad long. Depicted in picture below:
I trace into Click's source code, and pinpoint a hardcoded value in HelpFormatter.write_dl(), the col_max parameter determines first-column max-width, which is 30, and I hope to reduce it to 16.
As a Click-library user, how can I achieve this without modifying Click's source code? Maybe some class inheritance or patching trick?
Thank you in advance.
You can do something like this:
class MyHelpFormatter(click.HelpFormatter):
def write_dl(self, rows, col_max=5, col_spacing=2):
super().write_dl(rows, col_max, col_spacing)
click.Context.formatter_class = MyHelpFormatter
Check this answer for a similar example

How to use In operator for comparing multiple values in EXCEL with Drools

I am trying Drools excel to compare some values of products like I have P1,P2,P3...P10 Now I am comparing it with incoming value from request.
I tried in below way but I am receiving an error.
Can you please help to fix this issue. Hope I am making a simple mistake but not able to find it.
Thanks in advance.
You have too many parentheses.
The value in the product column is substituted as is into $param. The correct syntax we're looking for is ... in ("P1", "P2"); however you've provided ("P1", "P2") as the product value. This transforms to in (("P1", "P2")), which is not correct.
Remove the parentheses from the product cell: "P1", "P2".

Taleo Connect Client Script

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:
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.
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.
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:
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.
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>
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>

GAMS: retrieve information from solution

GAMS: I think I have a pretty simple question, however I'm stuck and was wondering if someone could help here.
A simplified version of my model looks like this:
set(i,t) ;
parameter price
D;
variable p(i,t)
e(i,t);
equations
Equation1
obj.. C=sum((i,t), p(i,t)*price);
Model file /all/ ;
Solve file minimizing C using MIP ;
Display C.l;
p(i,t) and e(i,t) are related:
Equation1 .. e(i,t)=e=e(i,t-1)+p(i,t)*D
Now I want to retrieve information from the solution: lets say I want to know at what t e(i,t) has a certain value for example --> e(i,t)= x(i) or otherwise formulated e(i,t=TD)=x(i) find TD, where x(i) thus is depending on i. Does anyone know how I can write this in to my GAMs model? To be clear I do not want to change anything about my solution and the model I have runs; I just want to retrieve this information from the solution given.
So far I tried a couple of thing and nothing worked. I think that this must be simple, can anyone help? Thank you!
Try something like this:
set i /i1*i10/
t /t1*t10/;
variable e(i,t);
*some random dummy "solution"
e.l(i,t) = uniformInt(1,10);
set find5(i,t) 'find all combinations of i and t for which e.l=5';
find5(i,t)$(e.l(i,t)=5) = yes;
display e.l,find5;
Hope that helps,
Lutz

How to sscanf this string?: "+CPMS: \"ME\",18,255,\"ME\",18,255,\"ME\",18,255"

So, I'm developing an application in C and I need to sscanf a string.
+CPMS: \"ME\",18,255,\"ME\",18,255,\"ME\",18,255
I need to get the number between the first and second commas, 18 in this example, but it can be from 0 to 255.
I'm trying to create the placeholder to get this but I can't seem to make it work.
I've tried lots of thing, but I can't understand why:
sscanf(pointer, "+CPMS: \"%*s\",%d", &intPointer);
doesn't work.
Can anyone help me?
Thank you.
Well, I'm going to answer my own question.
sscanf(pointer, "+CPMS: \"%*2s\",%d", &intPointer);
It looks like I needed to put the number of characters to ignore.
Hope it help someone else.