Page 1 of 1

how to implement Reject logic

Posted: Thu Oct 28, 2010 4:56 pm
by marpadga18
SUK |ECS |EC goods imported into UK |0 |31/12/20|28/01/98|
SUK |OTS |Outside The Scope 0% |0 |31/12/20|04/02/98|
SUK |PRO |Irrecoverable VAT pro-forma |17500 |31/12/20|01/01/06|
SUK |RVC |Reverse Charge-Int'l Service |0 |31/12/20|01/04/91|
SUK |UKB |Tax 17.5% |17500 |31/12/09|01/12/08|
SUK |UKB |Tax 15.0% |15000 |31/12/20|01/01/10|
SUK |UKN |UK Non Recoverable 0% |0 |31/12/20|04/02/98|
SUK |UKR |Reduced rate VAT 5% |5000 |31/12/20|01/01/97|

Above is the sample file format.
I need to reject row if the coumn does not have | before column that
record should be rejected.
I kept a reject link in transformer stage but how to give a condition I am
not able to do?
can any one can share their ideas??

Posted: Thu Oct 28, 2010 5:07 pm
by ray.wurlod
Use a reject link from the Sequential File stage that reads this file. Rows will be rejected if they don't contain the correct number of field delimiter characters.

Posted: Thu Oct 28, 2010 5:50 pm
by marpadga18
ray.wurlod wrote:Use a reject link from the Sequential File stage that reads this file. Rows will be rejected if they don't contain the correct number of field delimiter characters. ...
You mean keep a reject link from sequential file were I read the data?
no need for trnsformer stage?

Posted: Thu Oct 28, 2010 6:24 pm
by chulett
Yes. In PX it would be directly from the stage, source or target, not off the Transformer like you would do in the Server product.

Posted: Thu Oct 28, 2010 7:53 pm
by marpadga18
i kept a reject link from source seq_file stage
and Reject mode= output
than also it is not rejecting the records to reject link

it should reject in the below scenario mentioned if the coulmn does not have |before it reject it..
SHARPUK |ECS |EC goods imported into UK |0 |31/12/20|28/01/98|
SHARPUK |OTS |Outside The Scope 0% |0 |31/12/20|04/02/98|
SHARPUK |PRO |Irrecoverable VAT pro-forma |17500 |31/12/20|01/01/06|
SHARPUK |RVC Reverse Charge-Int'l Service |0 |31/12/20|01/04/91|
SHARPUK |UKB |Tax 17.5% |17500 |31/12/09|01/12/08|
SHARPUK |UKB |Tax 15.0% |15000 |31/12/20|01/01/10|
SHARPUK |UKN |UK Non Recoverable 0% |0 |31/12/20|04/02/98|
SHARPUK |UKR |Reduced rate VAT 5% |5000 |31/12/20|01/01/97|
SHARPUK |UKS |Tax Rate 17.5% 17500 |30/11/08|01/01/94|
SHARPUK |UKS Tax Rate 15.0% |15000 |31/12/09|01/12/08|
SHARPUK |UKS Tax Rate 17.5% |17500 |31/12/20|01/01/10|
SHARPUK |UKZ UK Zero Rate 0% |0 |31/12/20|04/02/98|
SHARPUK |UVO |"UK VAT Only " 17500 |31/12/20|01/01/94|
SHARPUK |WWV |Foreign Invoice NON UK VAT |0 |31/12/20|01/04/91|
SHARPUK |XMT |Exempt 0% |0 |31/12/20|28/01/98|

Re: how to implement Reject logic

Posted: Fri Oct 29, 2010 12:35 am
by ravireddy25
Hi,
Afer sequential file take transformer and do the count based on '|'
any way you will be knowing the max limit so that you can put constraint
in transformer saying that count less than that should be passed else rejected.

Re: how to implement Reject logic

Posted: Fri Oct 29, 2010 6:36 am
by marpadga18
hi Ravi thanks for reply but need some help!

in seq_file _stage i gave this format
Record level:
Final delimeter =none
Record delimeter = Unix new line
Field defaults:
Delimeter =|
Quote = none
job is running fine but problem when testing it with reject logic not able to get reject records:(:(:(

but not able to reject the records to reject file if coulmn doesnot have "|" before it..


I never did this scenario can u elaborate more? I mean what condition we should give? total "|" in file are 5 no need to vary about the last "|"
could you please give any example reagrding the condition in transformer stage?

These are the cloumns
Tra_Ori varchar 10
Tax_Ra varchar 10
Desc varchar 30
TR_1 varchar 7
expirydate varchar 8
effective dt varchar 8

Posted: Fri Oct 29, 2010 7:01 am
by udayk_2007
you can design your job this way

Seq_File------->Transformer------> Seq_File

In the source sequential file..take the complete record in only one field only..declare its length as the maximum possible length of a record according to your input specifications

Then use Dcount function in transformer which i guess,counts the number of occurence of given symbol (in your case its pipe)

If the value returned by Dcount function for a record, is less than the minimum number of pipes you are expecting,then direct it to the reject link

Hope this helps

Regards
Ulhas

Posted: Fri Oct 29, 2010 9:44 am
by marpadga18
chulett wrote:Yes. In PX it would be directly from the stage, source or target, not off the Transformer like you would do in the Server product. ...
in seq_file _stage i gave this format
Record level:
Final delimeter =none
Record delimeter = Unix new line
Field defaults:
Delimeter =|
Quote = none
reject mode=output

job is running fine but problem when testing it with reject logic not able to get reject records:(

but not able to reject the records to reject file if coulmn doesnot have "|" before it..


These are the cloumns
Tra_Ori varchar 10
Tax_Ra varchar 10
Desc varchar 30
TR_1 varchar 7
expirydate varchar 8
effective dt varchar 8

any clear solution for rejecting from source stage seq-file stage were I am redaing the data???

Posted: Fri Oct 29, 2010 11:51 am
by ray.wurlod
Try being more explicit with data types. VarChar is very forgiving. Change TR1 to integer and expirydate and effective_dt to date (with a format string of "%dd/%mm/%yy").

Posted: Fri Oct 29, 2010 1:04 pm
by marpadga18
hi
Need some condition in transformer stage to reject the rows if "|" are less than 5 so that i can reject that row?

Posted: Tue Nov 02, 2010 2:26 am
by nitkuar
ray.wurlod wrote:Use a reject link from the Sequential File stage that reads this file. Rows will be rejected if they don't contain the correct number of field delimiter characters. ...
Ray's solution should resolve the issue. Could you please provide some sample record which is not getting rejected as per your expectations.

Posted: Tue Nov 02, 2010 6:02 am
by ray.wurlod
marpadga18 wrote:Need some condition in transformer stage to reject the rows if "|" are less than 5 so that i can reject that row?
Constraint expression of

Code: Select all

Count(InLink.TheString, "|") >= 5

Posted: Sat Dec 04, 2010 11:24 am
by marpadga18
chulett wrote:Yes. In PX it would be directly from the stage, source or target, not off the Transformer like you would do in the Server product. ...
Thanks chulett it is rejecting when I keep reject link from source file itself thanks for ur help