Author |
Message
|
varun6 |
Posted: Tue Nov 18, 2014 6:36 am Post subject: Pattern in DFDL IIB 9 |
|
|
Newbie
Joined: 25 Oct 2012 Posts: 9
|
From the source we are receiving a value with Exponential as 1.2345e3 and the output value should be 1234, I'm able to give the pattern for this and also able to get the exact value. For the same filed we may except two type of input values above mentioned is one set and other is 3840000.1234 and the output for this value should be 384000012, where we should eliminate the last two digits and also the decimal point.
Can we specify two patterns for the same field in DFDL? |
|
Back to top |
|
 |
kimbert |
Posted: Tue Nov 18, 2014 11:33 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
So for the first type of input value you want to take the logical value of 1234.5 and convert it to 1234. So you are simply removing the fractional part ( not rounding ).
For the second type of input value in the same field you want to take the logical value of 3840000.1234, multiply by 100 and truncate.
So - how do you tell the difference between these two 'types' of input value? _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. |
|
Back to top |
|
 |
varun6 |
Posted: Tue Nov 18, 2014 11:43 am Post subject: |
|
|
Newbie
Joined: 25 Oct 2012 Posts: 9
|
Sometimes i may get with exponent and sometimes as decimal number. |
|
Back to top |
|
 |
kimbert |
Posted: Tue Nov 18, 2014 1:44 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
So you want to process this field using the following rules:
Code: |
IF the number is expressed in scientific notation ( with an exponent )
THEN truncate the result
ELSE multiply the number by 100 and truncate the result |
Is that correct? _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. |
|
Back to top |
|
 |
varun6 |
Posted: Thu Nov 20, 2014 7:14 am Post subject: |
|
|
Newbie
Joined: 25 Oct 2012 Posts: 9
|
I have found a solution for this. The only way is to write a custom esql file and use for the fields which we need to modify. I have created two patterns in which one pattern is, when we get a number with exponent and the other is when we get a decimal number. We can change the pattern in the DFDL but it only works for only one input.
Thank you |
|
Back to top |
|
 |
|