cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to know if the given value is string or numeric

Former Member
0 Likes
1,241

I need to know the given input value is a numeric or not in the transaction. I tried the following:

stringif( localnumber(Transaction.INPUT) == "NA",Transaction.INPUT, stringright( ("000000000000000000"&localnumber(Transaction.INPUT)), 18 )

But in the above case, when INPUT value is "123s" (if the first character is numeric), it returns "123", not "NA".

Is there any other way to handle this?

Thanks,

Sara

Accepted Solutions (0)

Answers (8)

Answers (8)

Former Member
0 Likes

Hi Sara,

How do you incorporate it into XMII application. It will be great to have General Exception Action Block.

Former Member
0 Likes

Hi Sajjad,

Search for developing custom action block in xMII. You will find some information on how you could develop and deploy the custom blocks in xMII.

Thanks,

Sara

Former Member
0 Likes

How do you write custom action block?

Former Member
0 Likes

Sajjad,

You could write your custom action blocks using Java.

Thanks,

Sara

Former Member
0 Likes

Here's some pseudo code as to how to do the matching in Java, if you don't already have it:

import java.util.regex.Matcher;

import java.util.regex.Pattern;

Matcher matcher = Pattern.compile(sPattern, Pattern.CASE_INSENSITIVE).matcher(sStringToCheck);

boolean bMatch = matcher.matches();

Of course, there are other compilation options for the Java regex package - but this is just an example.

- Rick

Former Member
0 Likes

Sara, I don't see anyother way.

Former Member
0 Likes

Yes, thats what it looks like. But we are planning to write a custom action block to achive this.

Thanks,

Sara

Former Member
0 Likes

In my previous post i added code. Save this code as a BLS transaction. Function of this transaction, is to check given input value is string or number. if it is string it will return "NA" other wise it will retrun the "number".

Former Member
0 Likes

<?xml version="1.0" encoding="utf-8"?>

<Transaction xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<TransactionAttributes>

<ContextItem>

<Name>Category</Name>

<Description>Transaction Category</Description>

<MinRange>0</MinRange>

<MaxRange>0</MaxRange>

<Value xsi:type="xsd:string"/>

<ReadOnly>true</ReadOnly>

</ContextItem>

<ContextItem>

<Name>Comments</Name>

<Description>User Comments</Description>

<MinRange>0</MinRange>

<MaxRange>0</MaxRange>

<Value xsi:type="xsd:string"/>

<ReadOnly>true</ReadOnly>

</ContextItem>

<ContextItem>

<Name>CreatedBy</Name>

<Description>Created By</Description>

<MinRange>0</MinRange>

<MaxRange>0</MaxRange>

<Value xsi:type="xsd:string"/>

<ReadOnly>true</ReadOnly>

</ContextItem>

<ContextItem>

<Name>CreationDate</Name>

<Description>Creation Date</Description>

<MinRange>0</MinRange>

<MaxRange>0</MaxRange>

<Value xsi:type="xsd:dateTime">2007-07-30T08:33:08</Value>

<ReadOnly>true</ReadOnly>

</ContextItem>

<ContextItem>

<Name>Description</Name>

<Description>Transaction Description</Description>

<MinRange>0</MinRange>

<MaxRange>0</MaxRange>

<Value xsi:type="xsd:string"/>

<ReadOnly>true</ReadOnly>

</ContextItem>

<ContextItem>

<Name>Status</Name>

<Description>Deployment Status</Description>

<MinRange>0</MinRange>

<MaxRange>0</MaxRange>

<Value xsi:type="xsd:string">DEVELOPMENT</Value>

<ReadOnly>true</ReadOnly>

</ContextItem>

<ContextItem>

<Name>LastEditedBy</Name>

<Description>Last Edited By</Description>

<MinRange>0</MinRange>

<MaxRange>0</MaxRange>

<Value xsi:type="xsd:string"/>

<ReadOnly>true</ReadOnly>

</ContextItem>

<ContextItem>

<Name>LastEditedDate</Name>

<Description>Last Edited Date</Description>

<MinRange>0</MinRange>

<MaxRange>0</MaxRange>

<Value xsi:type="xsd:dateTime">2007-07-30T11:05:28</Value>

<ReadOnly>true</ReadOnly>

</ContextItem>

</TransactionAttributes>

<Name>IsNumeric</Name>

<Version>10</Version>

<WriterRoles/>

<ReaderRoles/>

<Context>

<ContextItem>

<Name>input</Name>

<Description/>

<MinRange>0</MinRange>

<MaxRange>0</MaxRange>

<Value xsi:type="xsd:string">00000000000000000005679</Value>

<ReadOnly>false</ReadOnly>

</ContextItem>

<ContextItem>

<Name>output</Name>

<Description/>

<MinRange>0</MinRange>

<MaxRange>0</MaxRange>

<Value xsi:type="xsd:string"/>

<ReadOnly>false</ReadOnly>

</ContextItem>

</Context>

<Local>

<ContextItem>

<Name>DecTracker</Name>

<Description>Track number of Decimal point</Description>

<MinRange>0</MinRange>

<MaxRange>0</MaxRange>

<Value xsi:type="xsd:long">0</Value>

<ReadOnly>false</ReadOnly>

</ContextItem>

<ContextItem>

<Name>lntInput</Name>

<Description>Define the length of the input string</Description>

<MinRange>0</MinRange>

<MaxRange>0</MaxRange>

<Value xsi:type="xsd:long">0</Value>

<ReadOnly>false</ReadOnly>

</ContextItem>

</Local>

<Layout>

<GUILayoutItem>

<Name>Sequence_0</Name>

<X>8</X>

<Y>264</Y>

<Width>120</Width>

<SpacingWidth>120</SpacingWidth>

<DescendantWidth>120</DescendantWidth>

<Height>96</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>seqInputExample</Name>

<X>944</X>

<Y>136</Y>

<Width>120</Width>

<SpacingWidth>1992</SpacingWidth>

<DescendantWidth>1992</DescendantWidth>

<Height>96</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>Sequence_2</Name>

<X>944</X>

<Y>264</Y>

<Width>120</Width>

<SpacingWidth>1704</SpacingWidth>

<DescendantWidth>1704</DescendantWidth>

<Height>96</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>Sequence_3</Name>

<X>1880</X>

<Y>264</Y>

<Width>120</Width>

<SpacingWidth>120</SpacingWidth>

<DescendantWidth>0</DescendantWidth>

<Height>96</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>Sequence_4</Name>

<X>8</X>

<Y>392</Y>

<Width>120</Width>

<SpacingWidth>120</SpacingWidth>

<DescendantWidth>120</DescendantWidth>

<Height>96</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>CalculateInputStringLength</Name>

<X>16</X>

<Y>408</Y>

<Width>104</Width>

<SpacingWidth>0</SpacingWidth>

<DescendantWidth>0</DescendantWidth>

<Height>72</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>Sequence_5</Name>

<X>944</X>

<Y>392</Y>

<Width>120</Width>

<SpacingWidth>1704</SpacingWidth>

<DescendantWidth>1704</DescendantWidth>

<Height>96</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>LoopThroughTheString</Name>

<X>952</X>

<Y>408</Y>

<Width>104</Width>

<SpacingWidth>0</SpacingWidth>

<DescendantWidth>0</DescendantWidth>

<Height>72</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>Sequence_6</Name>

<X>944</X>

<Y>520</Y>

<Width>120</Width>

<SpacingWidth>1704</SpacingWidth>

<DescendantWidth>1704</DescendantWidth>

<Height>96</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>Tracer_0</Name>

<X>952</X>

<Y>536</Y>

<Width>104</Width>

<SpacingWidth>0</SpacingWidth>

<DescendantWidth>0</DescendantWidth>

<Height>72</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>Sequence_7</Name>

<X>944</X>

<Y>648</Y>

<Width>120</Width>

<SpacingWidth>1704</SpacingWidth>

<DescendantWidth>1704</DescendantWidth>

<Height>96</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>Tracer_1</Name>

<X>952</X>

<Y>664</Y>

<Width>104</Width>

<SpacingWidth>0</SpacingWidth>

<DescendantWidth>0</DescendantWidth>

<Height>72</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>Sequence_8</Name>

<X>944</X>

<Y>776</Y>

<Width>120</Width>

<SpacingWidth>1704</SpacingWidth>

<DescendantWidth>1704</DescendantWidth>

<Height>96</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>Switch_0</Name>

<X>952</X>

<Y>792</Y>

<Width>104</Width>

<SpacingWidth>0</SpacingWidth>

<DescendantWidth>0</DescendantWidth>

<Height>72</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>Sequence_9</Name>

<X>152</X>

<Y>904</Y>

<Width>120</Width>

<SpacingWidth>120</SpacingWidth>

<DescendantWidth>0</DescendantWidth>

<Height>96</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>Sequence_10</Name>

<X>296</X>

<Y>904</Y>

<Width>120</Width>

<SpacingWidth>120</SpacingWidth>

<DescendantWidth>0</DescendantWidth>

<Height>96</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>Sequence_11</Name>

<X>440</X>

<Y>904</Y>

<Width>120</Width>

<SpacingWidth>120</SpacingWidth>

<DescendantWidth>0</DescendantWidth>

<Height>96</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>Sequence_12</Name>

<X>584</X>

<Y>904</Y>

<Width>120</Width>

<SpacingWidth>120</SpacingWidth>

<DescendantWidth>0</DescendantWidth>

<Height>96</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>Sequence_13</Name>

<X>728</X>

<Y>904</Y>

<Width>120</Width>

<SpacingWidth>120</SpacingWidth>

<DescendantWidth>0</DescendantWidth>

<Height>96</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>Sequence_14</Name>

<X>872</X>

<Y>904</Y>

<Width>120</Width>

<SpacingWidth>120</SpacingWidth>

<DescendantWidth>0</DescendantWidth>

<Height>96</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>Sequence_15</Name>

<X>1016</X>

<Y>904</Y>

<Width>120</Width>

<SpacingWidth>120</SpacingWidth>

<DescendantWidth>0</DescendantWidth>

<Height>96</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>Sequence_16</Name>

<X>1160</X>

<Y>904</Y>

<Width>120</Width>

<SpacingWidth>120</SpacingWidth>

<DescendantWidth>0</DescendantWidth>

<Height>96</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>Sequence_17</Name>

<X>1304</X>

<Y>904</Y>

<Width>120</Width>

<SpacingWidth>120</SpacingWidth>

<DescendantWidth>0</DescendantWidth>

<Height>96</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>Sequence_18</Name>

<X>1448</X>

<Y>904</Y>

<Width>120</Width>

<SpacingWidth>120</SpacingWidth>

<DescendantWidth>0</DescendantWidth>

<Height>96</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>Sequence_19</Name>

<X>1592</X>

<Y>904</Y>

<Width>120</Width>

<SpacingWidth>120</SpacingWidth>

<DescendantWidth>120</DescendantWidth>

<Height>96</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>Sequence_20</Name>

<X>1736</X>

<Y>904</Y>

<Width>120</Width>

<SpacingWidth>120</SpacingWidth>

<DescendantWidth>120</DescendantWidth>

<Height>96</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>AssignOutPut</Name>

<X>952</X>

<Y>280</Y>

<Width>104</Width>

<SpacingWidth>0</SpacingWidth>

<DescendantWidth>0</DescendantWidth>

<Height>72</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>AssignException</Name>

<X>1744</X>

<Y>920</Y>

<Width>104</Width>

<SpacingWidth>0</SpacingWidth>

<DescendantWidth>0</DescendantWidth>

<Height>72</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>Sequence_21</Name>

<X>1736</X>

<Y>1032</Y>

<Width>120</Width>

<SpacingWidth>120</SpacingWidth>

<DescendantWidth>0</DescendantWidth>

<Height>96</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>BreakLoop</Name>

<X>1744</X>

<Y>1048</Y>

<Width>104</Width>

<SpacingWidth>0</SpacingWidth>

<DescendantWidth>0</DescendantWidth>

<Height>72</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>Tracer_2</Name>

<X>1888</X>

<Y>280</Y>

<Width>104</Width>

<SpacingWidth>0</SpacingWidth>

<DescendantWidth>0</DescendantWidth>

<Height>72</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>Sequence_22</Name>

<X>8</X>

<Y>520</Y>

<Width>120</Width>

<SpacingWidth>120</SpacingWidth>

<DescendantWidth>0</DescendantWidth>

<Height>96</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>AssignDefaultValueforDecTracker</Name>

<X>16</X>

<Y>536</Y>

<Width>104</Width>

<SpacingWidth>0</SpacingWidth>

<DescendantWidth>0</DescendantWidth>

<Height>72</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>Increment</Name>

<X>1600</X>

<Y>920</Y>

<Width>104</Width>

<SpacingWidth>0</SpacingWidth>

<DescendantWidth>0</DescendantWidth>

<Height>72</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>Sequence_23</Name>

<X>1592</X>

<Y>1032</Y>

<Width>120</Width>

<SpacingWidth>120</SpacingWidth>

<DescendantWidth>120</DescendantWidth>

<Height>96</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>ChkNumberDecimalPoint</Name>

<X>1600</X>

<Y>1048</Y>

<Width>104</Width>

<SpacingWidth>0</SpacingWidth>

<DescendantWidth>0</DescendantWidth>

<Height>72</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>Sequence_24</Name>

<X>1592</X>

<Y>1160</Y>

<Width>120</Width>

<SpacingWidth>120</SpacingWidth>

<DescendantWidth>120</DescendantWidth>

<Height>96</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>AssignExceptionForInvalidNumber</Name>

<X>1600</X>

<Y>1176</Y>

<Width>104</Width>

<SpacingWidth>0</SpacingWidth>

<DescendantWidth>0</DescendantWidth>

<Height>72</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>Sequence_25</Name>

<X>1592</X>

<Y>1288</Y>

<Width>120</Width>

<SpacingWidth>120</SpacingWidth>

<DescendantWidth>0</DescendantWidth>

<Height>96</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>BreakLoopForInvalidNumber</Name>

<X>1600</X>

<Y>1304</Y>

<Width>104</Width>

<SpacingWidth>0</SpacingWidth>

<DescendantWidth>0</DescendantWidth>

<Height>72</Height>

</GUILayoutItem>

<GUILayoutItem>

<Name>seqHeader</Name>

<X>944</X>

<Y>8</Y>

<Width>120</Width>

<SpacingWidth>1992</SpacingWidth>

<DescendantWidth>1992</DescendantWidth>

<Height>96</Height>

</GUILayoutItem>

</Layout>

<Actions>

<ContextItem>

<Name>CalculateInputStringLength</Name>

<Description/>

<MinRange>0</MinRange>

<MaxRange>0</MaxRange>

<Value xsi:type="Assignment"/>

<ReadOnly>false</ReadOnly>

</ContextItem>

<ContextItem>

<Name>LoopThroughTheString</Name>

<Description/>

<MinRange>0</MinRange>

<MaxRange>0</MaxRange>

<Value xsi:type="ForNextRepeaterAction">

<From>0</From>

<Break>false</Break>

<To>0</To>

<Step>1</Step>

<CurrentItem>0</CurrentItem>

</Value>

<ReadOnly>false</ReadOnly>

</ContextItem>

<ContextItem>

<Name>Tracer_0</Name>

<Description/>

<MinRange>0</MinRange>

<MaxRange>0</MaxRange>

<Value xsi:type="Tracer">

<Level>INFO</Level>

<Message/>

</Value>

<ReadOnly>false</ReadOnly>

</ContextItem>

<ContextItem>

<Name>Tracer_1</Name>

<Description/>

<MinRange>0</MinRange>

<MaxRange>0</MaxRange>

<Value xsi:type="Tracer">

<Level>INFO</Level>

<Message/>

</Value>

<ReadOnly>false</ReadOnly>

</ContextItem>

<ContextItem>

<Name>Switch_0</Name>

<Description/>

<MinRange>0</MinRange>

<MaxRange>0</MaxRange>

<Value xsi:type="SwitcherAction">

<MatchCount>11</MatchCount>

</Value>

<ReadOnly>false</ReadOnly>

</ContextItem>

<ContextItem>

<Name>AssignOutPut</Name>

<Description/>

<MinRange>0</MinRange>

<MaxRange>0</MaxRange>

<Value xsi:type="Assignment"/>

<ReadOnly>false</ReadOnly>

</ContextItem>

<ContextItem>

<Name>AssignException</Name>

<Description/>

<MinRange>0</MinRange>

<MaxRange>0</MaxRange>

<Value xsi:type="Assignment"/>

<ReadOnly>false</ReadOnly>

</ContextItem>

<ContextItem>

<Name>BreakLoop</Name>

<Description/>

<MinRange>0</MinRange>

<MaxRange>0</MaxRange>

<Value xsi:type="Assignment"/>

<ReadOnly>false</ReadOnly>

</ContextItem>

<ContextItem>

<Name>Tracer_2</Name>

<Description/>

<MinRange>0</MinRange>

<MaxRange>0</MaxRange>

<Value xsi:type="Tracer">

<Level>INFO</Level>

<Message/>

</Value>

<ReadOnly>false</ReadOnly>

</ContextItem>

<ContextItem>

<Name>AssignDefaultValueforDecTracker</Name>

<Description/>

<MinRange>0</MinRange>

<MaxRange>0</MaxRange>

<Value xsi:type="Assignment"/>

<ReadOnly>false</ReadOnly>

</ContextItem>

<ContextItem>

<Name>Increment</Name>

<Description/>

<MinRange>0</MinRange>

<MaxRange>0</MaxRange>

<Value xsi:type="Assignment"/>

<ReadOnly>false</ReadOnly>

</ContextItem>

<ContextItem>

<Name>ChkNumberDecimalPoint</Name>

<Description/>

<MinRange>0</MinRange>

<MaxRange>0</MaxRange>

<Value xsi:type="ConditionalAction">

<InputCount>1</InputCount>

<LogicalAnd>false</LogicalAnd>

</Value>

<ReadOnly>false</ReadOnly>

</ContextItem>

<ContextItem>

<Name>AssignExceptionForInvalidNumber</Name>

<Description/>

<MinRange>0</MinRange>

<MaxRange>0</MaxRange>

<Value xsi:type="Assignment"/>

<ReadOnly>false</ReadOnly>

</ContextItem>

<ContextItem>

<Name>BreakLoopForInvalidNumber</Name>

<Description/>

<MinRange>0</MinRange>

<MaxRange>0</MaxRange>

<Value xsi:type="Assignment"/>

<ReadOnly>false</ReadOnly>

</ContextItem>

</Actions>

<Steps>

<Step xsi:type="ActionSequence">

<Name>seqHeader</Name>

<Description>This transaction take a string as input and test if the string is numeric or not.

If it is numeric, it returns the value as output, otherwise it retruns as NA as output </Description>

<Steps>

<Step xsi:type="ActionSequence">

<Name>seqInputExample</Name>

<Description>input: 0000234S</Description>

<Steps>

<Step xsi:type="ActionSequence">

<Name>Sequence_0</Name>

<Description/>

<Steps>

<Step xsi:type="ActionSequence">

<Name>Sequence_4</Name>

<Description/>

<Steps>

<Step xsi:type="ActionSequence">

<Name>Sequence_22</Name>

<Description/>

<Steps/>

<Actions>

<Action>

<Name>AssignDefaultValueforDecTracker</Name>

<Description/>

<IncomingLinks/>

<OutgoingLinks>

<Assign xsi:type="Assign">

<Name/>

<Description/>

<To>Local.DecTracker</To>

<From>0</From>

</Assign>

</OutgoingLinks>

</Action>

</Actions>

</Step>

</Steps>

<Actions>

<Action>

<Name>CalculateInputStringLength</Name>

<Description/>

<IncomingLinks/>

<OutgoingLinks>

<Assign xsi:type="Assign">

<Name/>

<Description/>

<To>Local.lntInput</To>

<From>stringlength( Transaction.input )</From>

</Assign>

</OutgoingLinks>

</Action>

</Actions>

</Step>

</Steps>

<Actions/>

</Step>

<Step xsi:type="ActionSequence">

<Name>Sequence_2</Name>

<Description/>

<Steps>

<Step xsi:type="ForNextRepeater">

<Name>Sequence_5</Name>

<Description/>

<Steps>

<Step xsi:type="ActionSequence">

<Name>Sequence_6</Name>

<Description/>

<Steps>

<Step xsi:type="ActionSequence">

<Name>Sequence_7</Name>

<Description/>

<Steps>

<Step xsi:type="Switcher">

<Name>Sequence_8</Name>

<Description/>

<Steps>

<Step xsi:type="ActionSequence">

<Name>Sequence_9</Name>

<Description/>

<Steps/>

<Actions/>

</Step>

<Step xsi:type="ActionSequence">

<Name>Sequence_10</Name>

<Description/>

<Steps/>

<Actions/>

</Step>

<Step xsi:type="ActionSequence">

<Name>Sequence_11</Name>

<Description/>

<Steps/>

<Actions/>

</Step>

<Step xsi:type="ActionSequence">

<Name>Sequence_12</Name>

<Description/>

<Steps/>

<Actions/>

</Step>

<Step xsi:type="ActionSequence">

<Name>Sequence_13</Name>

<Description/>

<Steps/>

<Actions/>

</Step>

<Step xsi:type="ActionSequence">

<Name>Sequence_14</Name>

<Description/>

<Steps/>

<Actions/>

</Step>

<Step xsi:type="ActionSequence">

<Name>Sequence_15</Name>

<Description/>

<Steps/>

<Actions/>

</Step>

<Step xsi:type="ActionSequence">

<Name>Sequence_16</Name>

<Description/>

<Steps/>

<Actions/>

</Step>

<Step xsi:type="ActionSequence">

<Name>Sequence_17</Name>

<Description/>

<Steps/>

<Actions/>

</Step>

<Step xsi:type="ActionSequence">

<Name>Sequence_18</Name>

<Description/>

<Steps/>

<Actions/>

</Step>

<Step xsi:type="ActionSequence">

<Name>Sequence_19</Name>

<Description/>

<Steps>

<Step xsi:type="Conditional">

<Name>Sequence_23</Name>

<Description/>

<Steps>

<Step xsi:type="ActionSequence">

<Name>Sequence_24</Name>

<Description/>

<Steps>

<Step xsi:type="ActionSequence">

<Name>Sequence_25</Name>

<Description/>

<Steps/>

<Actions>

<Action>

<Name>BreakLoopForInvalidNumber</Name>

<Description/>

<IncomingLinks/>

<OutgoingLinks>

<Assign xsi:type="Assign">

<Name/>

<Description/>

<To>LoopThroughTheString.Break</To>

<From>true</From>

</Assign>

</OutgoingLinks>

</Action>

</Actions>

</Step>

</Steps>

<Actions>

<Action>

<Name>AssignExceptionForInvalidNumber</Name>

<Description/>

<IncomingLinks/>

<OutgoingLinks>

<Assign xsi:type="Assign">

<Name/>

<Description/>

<To>Transaction.output</To>

<From>"NA"</From>

</Assign>

</OutgoingLinks>

</Action>

</Actions>

</Step>

</Steps>

<Actions>

<Action>

<Name>ChkNumberDecimalPoint</Name>

<Description/>

<IncomingLinks>

<Assign xsi:type="Assign">

<Name/>

<Description/>

<To>ChkNumberDecimalPoint.Input1</To>

<From>Local.DecTracker&gt;1</From>

</Assign>

</IncomingLinks>

<OutgoingLinks/>

</Action>

</Actions>

</Step>

</Steps>

<Actions>

<Action>

<Name>Increment</Name>

<Description/>

<IncomingLinks/>

<OutgoingLinks>

<Assign xsi:type="Assign">

<Name/>

<Description/>

<To>Local.DecTracker</To>

<From>Local.DecTracker+1</From>

</Assign>

</OutgoingLinks>

</Action>

</Actions>

</Step>

<Step xsi:type="ActionSequence">

<Name>Sequence_20</Name>

<Description/>

<Steps>

<Step xsi:type="ActionSequence">

<Name>Sequence_21</Name>

<Description/>

<Steps/>

<Actions>

<Action>

<Name>BreakLoop</Name>

<Description/>

<IncomingLinks/>

<OutgoingLinks>

<Assign xsi:type="Assign">

<Name/>

<Description/>

<To>LoopThroughTheString.Break</To>

<From>true</From>

</Assign>

</OutgoingLinks>

</Action>

</Actions>

</Step>

</Steps>

<Actions>

<Action>

<Name>AssignException</Name>

<Description/>

<IncomingLinks/>

<OutgoingLinks>

<Assign xsi:type="Assign">

<Name/>

<Description/>

<To>Transaction.output</To>

<From>"NA"</From>

</Assign>

</OutgoingLinks>

</Action>

</Actions>

</Step>

</Steps>

<Actions>

<Action>

<Name>Switch_0</Name>

<Description/>

<IncomingLinks>

<Assign xsi:type="Assign">

<Name/>

<Description/>

<To>Switch_0.MatchValue1</To>

<From>"1"</From>

</Assign>

<Assign xsi:type="Assign">

<Name/>

<Description/>

<To>Switch_0.MatchValue2</To>

<From>"2"</From>

</Assign>

<Assign xsi:type="Assign">

<Name/>

<Description/>

<To>Switch_0.MatchValue3</To>

<From>"3"</From>

</Assign>

<Assign xsi:type="Assign">

<Name/>

<Description/>

<To>Switch_0.MatchValue4</To>

<From>"4"</From>

</Assign>

<Assign xsi:type="Assign">

<Name/>

<Description/>

<To>Switch_0.MatchValue5</To>

<From>"5"</From>

</Assign>

<Assign xsi:type="Assign">

<Name/>

<Description/>

<To>Switch_0.MatchValue6</To>

<From>"6"</From>

</Assign>

<Assign xsi:type="Assign">

<Name/>

<Description/>

<To>Switch_0.MatchValue7</To>

<From>"7"</From>

</Assign>

<Assign xsi:type="Assign">

<Name/>

<Description/>

<To>Switch_0.MatchValue8</To>

<From>"8"</From>

</Assign>

<Assign xsi:type="Assign">

<Name/>

<Description/>

<To>Switch_0.MatchValue9</To>

<From>"9"</From>

</Assign>

<Assign xsi:type="Assign">

<Name/>

<Description/>

<To>Switch_0.MatchValue10</To>

<From>"0"</From>

</Assign>

<Assign xsi:type="Assign">

<Name/>

<Description/>

<To>Switch_0.MatchValue11</To>

<From>"."</From>

</Assign>

<Assign xsi:type="Assign">

<Name/>

<Description/>

<To>Switch_0.InputValue</To>

<From>stringpart( Transaction.input , LoopThroughTheString.CurrentItem , 1 )</From>

</Assign>

</IncomingLinks>

<OutgoingLinks/>

</Action>

</Actions>

</Step>

</Steps>

<Actions>

<Action>

<Name>Tracer_1</Name>

<Description/>

<IncomingLinks>

<Assign xsi:type="Assign">

<Name/>

<Description/>

<To>Tracer_1.Message</To>

<From>stringpart( Transaction.input , LoopThroughTheString.CurrentItem , 1 )</From>

</Assign>

</IncomingLinks>

<OutgoingLinks/>

</Action>

</Actions>

</Step>

</Steps>

<Actions>

<Action>

<Name>Tracer_0</Name>

<Description/>

<IncomingLinks>

<Assign xsi:type="Assign">

<Name/>

<Description/>

<To>Tracer_0.Message</To>

<From>LoopThroughTheString.CurrentItem &amp; "-" &amp; "Loop" </From>

</Assign>

</IncomingLinks>

<OutgoingLinks/>

</Action>

</Actions>

</Step>

</Steps>

<Actions>

<Action>

<Name>LoopThroughTheString</Name>

<Description/>

<IncomingLinks>

<Assign xsi:type="Assign">

<Name/>

<Description/>

<To>LoopThroughTheString.From</To>

<From>1</From>

</Assign>

<Assign xsi:type="Assign">

<Name/>

<Description/>

<To>LoopThroughTheString.To</To>

<From>Local.lntInput</From>

</Assign>

</IncomingLinks>

<OutgoingLinks/>

</Action>

</Actions>

</Step>

</Steps>

<Actions>

<Action>

<Name>AssignOutPut</Name>

<Description/>

<IncomingLinks/>

<OutgoingLinks>

<Assign xsi:type="Assign">

<Name/>

<Description/>

<To>Transaction.output</To>

<From>Transaction.input</From>

</Assign>

</OutgoingLinks>

</Action>

</Actions>

</Step>

<Step xsi:type="ActionSequence">

<Name>Sequence_3</Name>

<Description/>

<Steps/>

<Actions>

<Action>

<Name>Tracer_2</Name>

<Description/>

<IncomingLinks>

<Assign xsi:type="Assign">

<Name/>

<Description/>

<To>Tracer_2.Message</To>

<From>"Final Out Put:- " &amp; Transaction.output</From>

</Assign>

</IncomingLinks>

<OutgoingLinks/>

</Action>

</Actions>

</Step>

</Steps>

<Actions/>

</Step>

</Steps>

<Actions/>

</Step>

</Steps>

</Transaction>

Former Member
0 Likes

Sajjad,

It looks like you are looping through each character in the given value. But we don't want to do that for performance reasons.

Thanks,

Sara

Former Member
0 Likes

Rick,

I am sorry. Your solution will not solve the issue.

If the input is "000000123", the localnumber() will return 123, and when you format back, how do you know how many zeros you had in the front?

Thanks,

Sara

Former Member
0 Likes

There's a "match" function that used to work for this type of test (with regex's), but one of the developers broke it.

If you know that your numbers will never have decimal places, you could convert to number, back to string with format(XXXX,"0"), then compare the length back to the original string. Use something like this for the conditional test in your stringif:

stringlength(format(localnumber(Transaction.INPUT),"0")) == stringlength(Transaction.INPUT)

If there was the potential to have whitespace involved, just add a stringtrim to the second part of the conditional as in:

stringlength(format(localnumber(Transaction.INPUT),"0")) == stringlength(stringtrim(Transaction.INPUT))

- Rick

Former Member
0 Likes

Thanks, Rick.

This will solve the problem.

I tried using the reg. exp and the function match() and I was not successful. Now I know that it is broken

Thanks,

Sara

Former Member
0 Likes

Rick,

I am sorry. Your solution will not solve the issue.

If the input is "000000123", the localnumber() will return 123, and when you format back, how do you know how many zeros you had in the front?

Thanks,

Sara

Former Member
0 Likes

Hi sara try with this one...

stringif(number(stringreplace( Transaction.INPUT , 0, 1 )) == stringreplace(Transaction.INPUT, 0,1),"number","string")

Hope this helps you

Former Member
0 Likes

Kishore,

Good workaround!

Thanks,

Sara

Former Member
0 Likes

Kishore,

Your solution does not work if the value is like "000000000000000067".

Thanks,

Sara

Former Member
0 Likes

You might need to call a function that looks at each individual character in the variable to make sure each individual character is numeric.

Former Member
0 Likes

Hi Rick - do you know if there is intent to fix it?

Sara - JavaScript also has a Regex object. I don't know if it is possible for your use, or necessarily a good idea, but perhaps you could use the JavaScript Regex object to validate your concerns BEFORE going into Business Logic.

Former Member
0 Likes

I don't have any javascript to do this. It is not a web application.

Thanks,

Sara

Former Member
0 Likes

No idea.

Former Member
0 Likes

Hi Sara,

Try using the following way,

stringif(Transaction.INPUT == number(Transaction.INPUT),"number","string")

write your condition if number in place of "number" string and string condition in "string" string.

Regards,

Ravi Kumar

Former Member
0 Likes

Ravi,

What if the input is a numeric and it has the value valid like 00000123?

If I use your logic, it will be treated as a string.

Thanks,

Sara

Former Member
0 Likes

Hi,

Try this and let me know,

stringif(Transaction.INPUT % number(Transaction.INPUT)== 0,"number","string")

Hey it's not working for "12123ss"

Regards,

Ravi Kumar

Message was edited by:

Ravi Kumar

Former Member
0 Likes

Ravi,

As I told earlier, if the first character is a numeric and even though there any alphas after that, the function number() returns a valid numeric value as the return.

For example:

stringif("000000123S" % number("000000123S")== 0,"number","string")

returns

"number", even though "000000123S" is a string.

Thanks,

Sara

Former Member
0 Likes

Hi sara,

try this

stringif(number(Transaction.INPUT) ==Transaction.INPUT, "number", "string")

If it is number it will give the boolean value of 1.

If any alpha numeric value comes it will return the boolean value of 0.

It returns number or string..

Hope this helps you.

Former Member
0 Likes

Kishore,

What if the value is "0000000000000123"? Your code will return "string", even though it is a valid numeric.

Thanks,

Sara