String to Numeric
Is there any direct method to extract numeric values from an alphanumeric string and assign to an integer?
Thanks
What do you mean by "alpha-numeric" string? That suggests that there are non-numeric characters in there as well. How you extract the numbers depends on the form of the string and the stability of that form amongst all possible Strings that will need 'extraction".
Similar Messages
-
Binary String to numerical binary array
Hello,
I initially created binary strings from numerical numbers using the
"%03b" command on the 'Format into String' block. I then concatenated
the various strings into one string that is now composed of 16bits.
However, I need to convert this string that I created back to a binary
numerical array for further processing.
Can you help me with this?
Thanks,
Rajesh.triniboy wrote:
I initially created binary strings from numerical numbers using the
"%03b" command on the 'Format into String' block. I then concatenated
the various strings into one string that is now composed of 16bits.
In general, you are out of luck, because the number of characters for each value when formatted to binary with "%03b", will be variable. Any number greater than 7 will use more than 3 digits. (since you use "03" instead of 3", smaller numbers will have three digits with possible leading zeroes for padding).
After you concatenated all the formatted strings, you loose all boundary information unless ALL numbers are less than 8, but in this case they result would be a multiple of 3 and would not add up to 16 bits, right?
My best suggestion would be to NOT create a binary formatted string in this way, because it is a one-way operation and cannot be undone because you loose information in the process.
Back to square one!
Maybe we can backup a few steps and you can explain to us what you really want to do with your original numbers. Why would you even consider formatting them this way? Do you need to save them to a file for later retrieval, for example?
LabVIEW Champion . Do more with less code and in less time . -
why this query
select [Measures].[F Events Count] on 0,
Filter([D Actor Player].[Actor].children,
([Measures].[F Events Count],
{([D Date].[Hierarchy].[Season].[2012 - 2013]),([D Date].[Hierarchy].[Season].[2013 - 2014])},
[D Result].[Result].&[Goal])
>=5) on 1
from [FBA Cube]
gives this error:
Query (3, 3) The >= function expects a string or numeric expression for the 1 argument. A tuple set expression was used.
while the following query works fine
select [Measures].[F Events Count] on 0,
Filter([D Actor Player].[Actor].children,
([Measures].[F Events Count],
[D Date].[Hierarchy].[Season].[2012 - 2013],
[D Result].[Result].&[Goal])
>=5) on 1
from [FBA Cube]
why having set inside Filter's boolean expression generates that error? how can we
keep the set inside the Filter's boolean expression but
solve the problem? please explain the reason and solutionHi Butmah ,
I think you should use an aggregation function with the set and the tuple ... adding an AdventureWorks snippet :
select [Measures].[Order Count] on 0,
Filter([Product].[Category].children,
SUM({[Date].[Fiscal].[Fiscal Year].&[2011],[Date].[Fiscal].[Fiscal Year].&[2009]}
,([Measures].[Order Count],[Geography].[Geography].[Country].&[United States])
>=5) on 1
from [Adventure Works]
Regards, David . -
How to know if the given value is string or numeric
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<?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>
-
Simple Java Question - How to test if a given string is numeric or not
Hi Experts,
I have written one Java program. It fetches user ID from UME. The code is as below:
Iterator itr = role.getUserMembers(true);
while (itr.hasNext()) {
String uniqId = (String) itr.next();
IUser thisUser = myUserFactory.getUser(uniqId);
wdComponentAPI.getMessageManager().reportSuccess("here "+thisUser.getUid() );
Used ID is thisUser.getUid() . I have to find out all user IDs which are numeric.
Do we have any standard Java program (API) to find out whether thisUser.getUid() is numeric or not.
Regards,
GaryHi
Just try to parse this string to integer or long number and catch the NumberFormatException.
Somthing like:
try
Integer.parseInt(userIdString);
catch(NumberFormatException e)
//do sume thing when user id is not number
good luck -
Need help in converting string to numeric array
I am trying to convert a string to a numeric array ... the first # in the string gets cut off, the last three seem to come through.
This may be fairly simple, but I really haven't worked with the string functions all that much.
Help would be appreciated.
Thanks,
Attachments:
String to Array Example.vi 10 KBSteve Chandler wrote:
If you remove the first and last byte from the string using string subset then the read spreadsheet string would probably have worked.
Yup.
LabVIEW Champion . Do more with less code and in less time .
Attachments:
String to Array ExampleMOD2.vi 10 KB -
How can you determine if a character in a string is numeric or alphabetic?
Hello all,
I've been trying this one for awhile now, and can't find any way to do it.
I am reading a character string out of a text file. The string is a number. I need to convert that number to it's decimal equivalent -- this is not a problem, I can do this easily.
The problem comes in when I'm reading the string from the text file. I want to be able to be sure that they didn't have a typo and insert an alphabetic character into the number. For example, typing 50o instead of 500. If I convert this example, I will read 50. I want it to flag an error instead, but I cannot figure out how to read the string and determine if there are alphabetic and numeric characters in the string I'm
reading.
Any help would be greatly appreciated.
Dave Neumann
[email protected]You can also use the "Scan from String" function. If the "remaining string" output is not a null string, or the error output is reporting an error, something went wrong with the conversion.
Mike...
Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion
"... after all, He's not a tame lion..."
Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps -
How to check the value of a string is numeric, alphanumeric or characters?
Hi All,
I have a task to validate an employee Id. Suppose the employee Id is E121212. Now as per the validation rule I need to check "the first letter of the employee Id is a character and rest are numbers." How can I do this? Please reply.
Thanks & Regards
Bibhuprasad Soumyaranjan>
Hi Bibhuprasad,
I have a task to validate an employee Id. Suppose the employee Id is
E121212. Now as per the validation rule I need to check "the first letter
of the employee Id is a character and rest are numbers." How can I do this? Please reply.Everyone else has proposed REGEXP_LIKE, and while it's very powerful, it is
also very CPU intensive. You should always use Oracle's string functions
instead of Regular Expressions if possible.
I played around with
WITH data
AS (SELECT 'E11212' s FROM DUAL
UNION ALL
SELECT '121212' FROM DUAL
UNION ALL
SELECT 'EE121212' FROM DUAL
UNION ALL
SELECT 'É121212' FROM DUAL
UNION ALL
SELECT 'E1EEEEEEEE' FROM DUAL
UNION ALL
SELECT 'E134343444' FROM DUAL)
SELECT s,
CASE
WHEN (SUBSTR(s, 1, 1) BETWEEN 'A' AND 'Z') -- AND (TO_NUMBER(SUBSTR(s, 2, LENGTH(s)), 999999) > 111111)
THEN 'Correct Format'
ELSE
'Incorrect Format'
END mySSN,
SUBSTR(s, 2, LENGTH(s)) AS theNumber
FROM data;I think that this can be worked so that it willl go what you require without using
REGEXP_LIKE.
HTH,
Paul...
Bibhuprasad Soumyaranjan -
Select from table where last character in string is numeric
Hello,
I have a table STREETS with a field called ADDRESS. I would like to select all records from streets where the last character in Address is a number.
Select ADDRESS from STREETS where regexp_like(substr(address, ?,?,), '[0-9]');
--? means that I don't know what to put in here!
I'm not sure if substr is the best approach for this, since i only want the last character and the records are of varying lengths.
Thanks!Hi,
If you want to use regular expressions:
WHERE REGEXP_LIKE ( address
, '[0-9]$'
)You can get the same results, probably more efficiently, without regular expressions:
WHERE INSTR ( '0123456789'
, SUBSTR (address, -1)
) > 0 -
Find a string between numeric in a column using SQL Query
Hi need help with the query in SQL. let say i have a column that has 2000 data.. i just need to show the data that has A at the strating of the data. For example:
A100001
W23456
A234444
I just need to show all the data got "A" at the start.
Thank uI don't think there is any standard command, so you will need to search for the pattern matching commands of your DBMS.
In SQL Server the keyword is "like", so your query would be Select col1 from tbl1 where col1 like 'A%'
Try to take over the world! -
How to get numeric data from a string using t-sql
Hi All,
I have a table with 2 columns ID as Int and Message as nvarchar(max)
Create table Sample
ID int not null,
Message nvarchar(max) null,
CONSTRAINT [PK_ID_Msg] PRIMARY KEY CLUSTERED
ID asc
Insert statement:
INSERT INTO
Sample (ID, Message)
VALUES (1, 'X_YRS: 00 ; X_MONS: 18 ; X_DAYS: 000 ; Y_YRS: 00 ; Y_MONS: 16 ; Y_DAYS: 011 ; Z: 1 ; Z_DATE: 09/04/2014
INSERT INTO Sample (ID, Message) VALUES (2, 'X_YRS: 01 ; X_MONS: 15 ; X_DAYS: 010 ; Y_YRS: 00 ; Y_MONS: 18 ; Y_DAYS: 017
; Z: 1
; Z_DATE: 06/02/2012')
Data in the table looks like:
ID Message
1 X_YRS: 00 ; X_MONS: 18 ; X_DAYS: 000 ; Y_YRS: 00 ; Y_MONS: 16 ; Y_DAYS: 011 ; Z: 1 ; Z_DATE: 09/04/2014
2 X_YRS: 01 ; X_MONS: 15 ; X_DAYS: 010 ; Y_YRS: 00 ; Y_MONS: 18 ; Y_DAYS: 017 ; Z: 1 ; Z_DATE: 06/02/2012
Need out put as below, just with numeric data:
ID X-Column Y-Column
1 00 18 000 00 16 011
2 01 15 010 00 18 017
So, please I need t-SQL to get above output.
Thanks in advance.
RH
sql;With CTE
AS
SELECT s.ID,RTRIM(LTRIM(STUFF(Val,1,CHARINDEX(':',Val),''))) AS Val,RTRIM(LTRIM(LEFT(Val,CHARINDEX('_',Val+'_')-1))) AS Pattern,
--ROW_NUMBER() OVER (PARTITION BY LEFT(Val,CHARINDEX('_',Val+'_')-1) ORDER BY RTRIM(LTRIM(STUFF(Val,1,CHARINDEX(':',Val),'')))*1)
f.ID AS Seq
FROM Sample s
CROSS APPLY dbo.ParseValues(s.[Message],';')f
WHERE ISNUMERIC(RTRIM(LTRIM(STUFF(Val,1,CHARINDEX(':',Val),'')))+'0.0E0')=1
SELECT ID,
STUFF((SELECT ' ' + Val FROM CTE WHERE ID = c.ID AND Pattern = 'X' ORDER BY Seq FOR XML PATH('')),1,1,'') AS XCol,
STUFF((SELECT ' ' + Val FROM CTE WHERE ID = c.ID AND Pattern = 'Y' ORDER BY Seq FOR XML PATH('')),1,1,'') AS YCol,
STUFF((SELECT ' ' + Val FROM CTE WHERE ID = c.ID AND Pattern = 'Z' ORDER BY Seq FOR XML PATH('')),1,1,'') AS ZCol
FROM (SELECT DISTINCT ID FROM CTE)c
ParseValues can be found here
http://visakhm.blogspot.in/2010/02/parsing-delimited-string.html
Numeric check logic is as per below
http://visakhm.blogspot.in/2014/03/checking-for-integer-or-decimal-values.html
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Problem in sorting numeric string
hii
i have created one method using comparator and passed a list with list of strings as argument to sort method of Collections class.The string ,which is combined a string and numeric value for example A1,A2,A11,A3 .....So i wanted the result as A1,A2,A3..A11,A12... and so on as final output.but when i print the output ,they are sorted as A1,A11,A12....A2,A3....so i learned from javadoc why those are sorted as like since comparator is using charAt() method while making override compare() method.but i am not expected this sorting for my application. i need sorting output as A1,A2,A3...A11,A12.....How to compare a string with another string both have combination of string and number using java?
if any one know the logic reply me.
i have pasted my code,if any changes have to be made only in this code,correct the code.
package sample.sorting;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
public class SortString {
public static List<String> sort(List<String> data) {
Collections.sort(data,new Comparator<String>(){
public int compare(String s1,String s2) {
return s1.compareTo(s2) ;
return data;
public static void main(String[] args) {
List<String> sortList = new ArrayList<String>();
sortList.add("A1");
sortList.add("A3");
sortList.add("A2");
sortList.add("A9");
sortList.add("A11");
sortList.add("A6");
List<String> sort = sort(sortList);
for(String str : sort) {
System.out.println("STR :: "+str); // O/P : A1,A11,A2,A3,A6... but expected O/P : A1,A2,A3..A11.
}thanks in advance.
with regards
Oasisderts
Edited by: oasisdesert on Dec 29, 2009 4:15 AMIn the compare method of the comparator, check if two Strings have equal length, if so compare them as normal, otherwise treat them as a separate case.
e.g. uncompiled return s1.length == s2.length ? s1.compareTo(s2) : if(s1.length < s2.length) -1 else 1;Mel -
Hi:
I'm using a field that contains only digits (0..9) and will use this field as a primary key. Does it make any difference if the field is a varchar or a numeric? I do not plan on performing any mathematical operations on the field's value, so it would be easier to store & retrieve as a varchar. But is it quicker to assess a row based on a primary key which is numeric or varchar?
Thanks.
- Rolf.You would, potentially, have to call TO_CHAR on the number when you wrote it out, but I would tend to just rely on implicit conversion there. Depending on how you are reading the XML response, you can probably get a numeric value back without doing any conversion.
I would have two primary functional considerations here
1) Is this a key that any human will ever use? If you are generating an invoice number, for example, someone may want to look up that invoice using the invoice number even though invoice number doesn't have any business meaning. Do the users think of this string in numeric terms? Or as a string? For example, do the users see value 1 as the same as 000001? Or would they prefer to always enter the "right" number of characters.
2) Data integrity- if non-numeric characters would be incorrect, the field should be a number. Otherwise, someone will end up writing alphabetical characters to the field.
Both of these would tend toward using NUMBER columns, unless users were really attached to the idea that it isn't invoice #1, it is invoice "000000001".
As secondary factors, numbers are more compact than strings, so performance is likely to be marginally better with numers rather than strings. By the same token, the table and index(es) are likely to cnosume less disk space when you use numbers. Performance here, though, should be a secondary consideration to functionality.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
Returning strings from OLE2 Word object (Forms 4.5)
Below is an example of how to return string and numeric values from OLE2 objects. In this example the OLE2 object is a MS Word document, and I want to fetch all the bookmarks in the Document into a Forms 4.5 Varchar2. To do this I first need to get the count of bookmarks.
Getting a string property from an OLE2 object is a common OLE2 requirement but is poorly documented. This is the ONLY way it can be done, as OLE2.INVOKE_CHAR returns a single character not a string. Use OLE2.INVOKE_OBJ, then OLE2.GET_CHAR_PROPERTY which does return a string, as shown below, to return a string from an OLE object (or OLE property).
Also note how you can only get the child object from its parent, not the grandchild (etc) object, so multiple (cascading) GET_OBJ_PROPERTY calls are required.
/* by: Marcus Anderson (Anderson Digital) (MarcusAnderson.info) */
/* name: Get_Bookmarks */
/* desc: Returns a double quoted CSV string containing the document*/
/* bookmarks. CSV string will always contain a trailing comma*/
/* EG: "Bookmark1","Bookmark2",Bookmark3",Bookmark4", */
/* NB: This requires that Bookmarks cannot contain " chr */
PROCEDURE Get_Bookmarks (pout_text OUT VARCHAR2)
IS
v_text VARCHAR2(80);
v_num NUMBER(3);
v_arglist OLE2.LIST_TYPE;
v_Application OLE2.OBJ_TYPE;
v_ActiveDoc OLE2.OBJ_TYPE;
v_Bookmarks OLE2.OBJ_TYPE;
v_Item OLE2.OBJ_TYPE;
v_i NUMBER(3);
BEGIN
v_Application := LDWord.MyApplication; -- Word doc opened elsewhere
/* Set v_num = ActiveDocument.Bookmarks.Count */
v_ActiveDoc := OLE2.GET_OBJ_PROPERTY (v_Application, 'ActiveDocument');
v_Bookmarks := OLE2.GET_OBJ_PROPERTY (v_ActiveDoc , 'Bookmarks');
v_num := OLE2.GET_NUM_PROPERTY (v_Bookmarks, 'Count'); -- NB: Returns numeric property
/* Build the output string, pout_text. */
FOR v_i in 1..v_num LOOP
/* Set v_item = ActiveDocument.Bookmarks.Item(v_i) */
v_arglist := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG (v_arglist, v_i);
v_Item := OLE2.INVOKE_OBJ (v_Bookmarks, 'Item', v_arglist); -- NB: returns parent object (array element)
OLE2.DESTROY_ARGLIST (v_arglist);
/* Set v_text = ActiveDocument.Bookmarks.Item(v_i).Name */
v_text := OLE2.GET_CHAR_PROPERTY (v_Item, 'Name'); -- NB: Returns string/varchar2 property
pout_text := pout_text || '"' || v_text || '",' ;
END LOOP;
END;Please repost in the Forms discussion forum.
- OTN -
ABAP-based web service returns numeric values with leading zeros
Hi SOA experts,
I have created a web service out of an ABAP function module. Beside other values, this service returns a list of document numbers. All of these numeric values are returned by the web service with leading zeros, but we do want these values w/o leading zeros.
Any ideas how I can tell the web service to not print any leading zeros?
Thanks in advance for your help!
Kind regards, Matthias
PS: The according function module does not print any leading zeros for the numeric valueshi,
just a guess: I'd try to use I instead of NUMC for the document numbers.
NUMC is no number but a character string with numeric characters only. only some display routines in SAP know that this string of numerals represents a number and omit leading zeroes.
my 2 cents,
anton
Maybe you are looking for
-
Print dialog window in report generation
Hi... I would like to create a report from my database and send it to printer. Basicly i want to use something like print report.vi in labview examples. But the sample is print directly to the default printer, how can i display print dialog window so
-
Error when determining a number from object BI_TSDTEL and number 01
Hi BW Experts, After Transporting Infosources (Master & Transaction) to BW QA, the transfer rules were not getting activated in QA. The following error message was diaplyed. "Error when determining a number from object BI_TSDTEL and number 01 Object
-
Acrobat 9 Professional Installation
Is there way to limit or meter the number of installations that can be done from the install DVD? Here is the reason: we currently have off-site users that request either Adobe Acrobat 9 pro or standard for business use. Currently we install locall
-
Create list item in sharepoint online list throws error in iPhone
Hi all : I have got a piece of JS code where I am creating multiple list items. So first I am creating an Expense item and then each of the expense line item( 5 of those ) in a different list. It creates the Expense item successfully and then when it
-
Why wont my finished movie upload to youtube
why wont my movie upload to youtube it just says its uploading and when its finished i check youtube and its not there!