Regular expression or format into string (nevermind)
Solved it,
I can use string to fractional number!
Hi,
I have a 2D string array from a multicolumn list box, and i want to check if every value is valid number, the numbers can be a single and can have negative values. Does anyone knows which regular expression i need to check this, or is there an ever better way doing it?
Best regards,
Thijs
Solved!
Go to Solution.
You shoudl post your solution so others who have a similar issue can learn from how you solved it.
Mark Yedinak
"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Similar Messages
-
Regular expressions in Format Definition add-on
Hello experts,
I have a question about regular expressions. I am a newbie in regular expressions and I could use some help on this one. I tried some 6 hours, but I can't get solve it myself.
Summary of my problem:
In SAP Business One (patch level 42) it is possible to use bank statement processing. A file (full of regular expressions) is to be selected, so it can match certain criteria to the bank statement file. The bank statement file consists of a certain pattern (look at the attached code snippet).
:61:071222D208,00N026
:86:P 12345678BELASTINGDIENST F8R03782497 $GH
$0000009 BETALINGSKENM. 123456789123456
0 1234567891234560
:61:071225C758,70N078
:86:0116664495 REGULA B.V. HELPMESTRAAT 243 B 5371 AM HARDCITY HARD
CITY 48772-54314
:61:071225C425,05N078
:86:0329883585 J. MANSSHOT PATTRIOTISLAND 38 1996 PT HELMEN BIJBETA
LING VOOR RELOOP RMP1 SET ORDERNR* 69866 / SPOEDIG LEVEREN
:61:071225C850,00N078
:86:0105327212 POSE TELEFOONSTRAAT 43 6448 SL S-ROTTERDAM MIJN OR
DERNR. 53846 REF. MAIL 21-02
- I am in search of the right type of regular expression that is used by the Format Definition add-on (javascript, .NET, perl, JAVA, python, etc.)
Besides that I need the regular expressions below, so the Format Definition will match the right lines from my bankfile.
- a regular expression that selects lines starting with :61: and line :86: including next lines (if available), so in fact it has to select everything from :86: till :61: again.
- a regular expression that selects the bank account number (position 5-14) from lines starting with :86:
- a regular expression that selects all other info from lines starting with :86: (and following if any), so all positions that follow after the bank account number
I am looking forward to the right solutions, I can give more info if you need any.Hello Hendri,
Q1:I am in search of the right type of regular expression that is used by the Format Definition add-on (javascript, .NET, perl, JAVA, pythonetc.)
Answer: Format Definition uses .Net regular expression.
You may refer the following examples. If necessary, I can send you a guide about how to use regular expression in Format Defnition. Thanks.
Example 6
Description:
To match a field with an optional field in front. For example, u201C:61:0711211121C216,08N051NONREFu201D or u201C:61:071121C216,08N051NONREFu201D, which comprises of a record identification u201C:61:u201D, a date in the form of YYMMDD, anther optional date MMDD, one or two characters to signify the direction of money flow, a numeric amount value and some other information. The target to be matched is the numeric amount value.
Regular expression:
(?<=:61:\d(\d)?[a-zA-Z]{1,2})((\d(,\d*)?)|(,\d))
Text:
:61:0711211121C216,08N051NONREF
Matches:
1
Tips:
1. All the fields in front of the target field are described in the look behind assertion embraced by (?<= and ). Especially, the optional field is embraced by parentheses and then a u201C?u201D (question mark). The sub expression for amount is copied from example 1. You can compose your own regular expression for such cases in the form of (?<=REGEX_FOR_FIELDS_IN_FRONT)(REGEX_FOR_TARGET_FIELD), in which REGEX_FOR_FIELDS_IN_FRONT and REGEX_FOR_TARGET_FIELD are respectively the regular expression for the fields in front and the target field. Keep the parentheses therein.
Example 7
Description:
Find all numbers in the free text description, which are possibly document identifications, e.g. for invoices
Regular expression:
(?<=\b)(?<!\.)\d+(?=\b)(?!\.)
Text:
:86:GIRO 6890316
ENERGETICA NATURA BENELU
AFRIKAWEG 14
HULST
3187-A1176
TRANSACTIEDATUM* 03-07-2007
Matches:
6
Tips:
1. The regular expression given finds all digits between word boundaries except those with a prior dot or following dot; u201C.u201D (dot) is escaped as \.
2. It may find out some inaccurate matches, like the date in text. If you want to exclude u201C-u201D (hyphen) as prior or following character, resemble the case for u201C.u201D (dot), the regular expression becomes (?<=\b)(?<!\.)(?<!-)\d+(?=\b)(?!\.)(?!-). The matches will be:
:86:GIRO 6890316
ENERGETICA NATURA BENELU
AFRIKAWEG 14
HULST
3187-A1176
TRANSACTIEDATUM* 03-07-2007
You may lose some real values like u201C3187u201D before the u201C-u201D.
Example 8
Description:
Find BP account number in 9 digits with a prior u201CPu201D or u201C0u201D in the first position of free text description
Regular expression:
(?<=^(P|0))\d
Text:
0000006681 FORTIS ASR BETALINGSCENTRUM BV
Matches:
1
Tips:
1. Use positive look behind assertion (?<=PRIOR_KEYWORD) to express the prior keyword.
2. u201C^u201D stands for that match starts from the beginning of the text. If the text includes the record identification, you may include it also in the look behind assertion. For example,
:86:0000006681 FORTIS ASR BETALINGSCENTRUM BV
The regular expression becomes
(?<=:86:(P|0))\d
Example 9
Description:
Following example 8, to find the possible BP name after BP account number, which is composed of letter, dot or space.
Regular expression:
(?<=^(P|0)\d)[a-zA-Z. ]*
Text:
0000006681 FORTIS ASR BETALINGSCENTRUM BV
Matches:
1
Tips:
1. In this case, put BP account number regular expression into the look behind assertion.
Example 10
Description:
Find the possible document identifications in a sub-record of :86: record. Sub-record is like u201C?00u201D, u201C?10u201D etc. A possible document identification sub-record is made up of the following parts:
u2022 keyword u201CREu201D, u201CRGu201D, u201CRu201D, u201CINVu201D, u201CNRu201D, u201CNOu201D, u201CRECHNu201D or u201CRECHNUNGu201D, and
u2022 an optional group made up of following:
a separator of either a dot, hyphen or slash, and
an optional space, and
an optional string starting with keyword u201CNRu201D or u201CNOu201D followed by a separator of either a dot, hyphen or slash, and
an optional space
u2022 and finally document identification in digits
Regular expression:
(?<=\?\d(RE|RG|R|INV|NR|NO|RECHN|RECHNUNG)((\.|-|/)\s?((NR|NO)(\.|-|/))?\s?)?)\d+
Kind Regards
-Yatsea -
Format into string 16 bit signed integer
Is there any format specifier string for "Format into string", whereas the result is an I16 string?
My problem is when I use "%d" and the input string is 65535, the result string should be "-1".
Solved!
Go to Solution.Are you trying to get an integer out of an ASCII string (Scan from String) or turn an integer into a string (Format into String). You title and question seem to contradict each other.
Assuming you are trying to scan from string, it looks like you need to scan into a U16 and then use a conversion bullet to turn it into an I16.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Attachments:
Scan I16.png 11 KB -
Hello all,
I would like to format a string with "a white space" between each
string member. i am at odds as for the format, for the "format
string" in the Format Into String function. let me rephrase that...
the format which needs to be used to format the "FORMAT STRING" in the
Format Into String function.
i looked at the help, but it seemed very nebulous to me. all i need is
to have "a white space" or a "carriage return" between the string
members and store it to a file.
thank you,
cheers,
-U> I would like to format a string with "a white space" between each
> string member. i am at odds as for the format, for the "format
> string" in the Format Into String function. let me rephrase that...
> the format which needs to be used to format the "FORMAT STRING" in the
> Format Into String function.
>
> i looked at the help, but it seemed very nebulous to me. all i need is
> to have "a white space" or a "carriage return" between the string
> members and store it to a file.
>
The format string is basically what ANSI C uses, but that string
function has a dialog to help you build it. Either double click the
node or right click and use the last item.
In the dialog, you can place a format string followed by an exact string
followed by another format
string. For the exact string you can enter a
space to output a white space, but to do a carriage return you have to
use a \n or \r.
Another way to do this, which I think is much easier and easier to read,
is to use the Concatonate Strings node with three inputs. To the top
wire the first string, to the middle wire a string constant from the
next to last row. This is a much cleaner way to do the constants. And
on the bottom input put the other string.
Format into String is much more powerful when appending many types of
data, but the simple append is clearer when it is powerful enough.
Greg McKaskle -
How not to omit leading binary zeros with format into string
I'm using format into string to format serial data . The problem I'm having is that Format into String with "%b" format identifier omits leading zeros
in the string.. ie... "3" becomes "11" when I need it as "0011"
Solved!
Go to Solution.see figure:
Attachments:
Example_VI.png 3 KB -
How to write regular expression to find desired string piece *duplicate*
Hi All,
Suppose that i have following string piece:
name:ali#lastname:kemal#name:mehmet#lastname:cemalI need
ali
mehmetI use following statement
SQL> select lst, regexp_replace(lst,'(name:)(.*)(lastname)(.*)','\2',1,1) nm from (
2 select 'name:ali#lastname:kemal#name:mehmet#lastname:cemal' as lst from dual
3 );
LST NM
name:ali#lastname:kemal#name:mehmet#lastname:cemal ali#lastname:kemal#name:mehmet#
SQL> But it does not return names correctly. When i change 5th parameter(occurence) of regexp_replace built-in function(e.g. 1,2), i may get ali and mehmet respectiveley.
Any ideas about regexp?
Note : I can use PL/SQL instr/substr for this manner; but i do not want to use them. I need regexp.
Regards...
Mennan
Edited by: mennan on Jul 4, 2010 9:53 PM
thread was posted twice due to chrome refresfment. Please ignore the thread and reply to How to write regular expression to find desired string pieceThe approach is to do cartesian join to a 'number' table returning number of records equal to number of names in the string.I have hardcoded 2 but you can use regexp_count to get the number of occurrences of the pattern in the string and then use level <=regexp_count(..... .
See below for the approach
with cte as(
select
'name:ali#lastname:kemal#name:mehmet#lastname:cemal' col ,level lev
from dual connect by level <=2)
select substr(regexp_substr('#'||col,'#name:\w+',1,lev),7)
from cte
/ -
Regular Expression for Match Pattern (string) Function
I need to find a variable length string enclosed by brackets and
within a string. Can't seem to get the regular expression right for
the Match Pattern function. I'm able to get the job done using the
Token function, but it's not as slick or tight as I'd like. Does
anybody out there have the expression for this?Jean-Pierre Drolet wrote in message news:<[email protected]>...
> The regular expression is "\[[~\]]*\]" which means:
> look for a bracket "\[" (\ is the escape char)
> followed by a string not containing a closing bracket "[~\]]*"
> followed by a closing bracket "\]". The match string include the
> brackets
>
> You can also read "Scan from String" with the following format:
> "%[^\[]\[%[^\[\]]" and read the 2nd output. The brackets are removed
> from the scanned string.
Thanks, Jean_Pierre
I did some more experimenting after posting and found that \[.*\] also
works with the match pattern function. Thanks for your input.
sm -
Regular Expressions and Numbers in Strings
Looking for someone who has had experience in using Regular Expressions in the Classification Rule Builder.
We have an eVar that is collecting the number of search results in this fashion:
<Total Results>_<# of Item 1>_<# of Item 2>_<# of Item 3>_<# of Item 4>
Example output would look like this:
150_50_0_25_75
What we've done is initially create a Regular Expression that looks like this:
^(.+)\_(.+)\_(.+)\_(.+)\_(.+)$
The problem is, it appears in situations where the output contains a zero in one of the slots, the value is ignored and it receives the value in the next place over. Using the example output shown above, I would end up with values like this:
$0 150_50_0_25_75
$1 150
$2 50
$3 25
$4 75
$5 {null}
Here's the weird part. When I perform a test of a single record, it appears like it will work just fine, but when it actually runs in Omniture, it's not working as expected. Here's something else I'd like to know if it's possible to address. The five-place string is only the newest iteration of this approach. In the past, we started out with a two-place version, then three-place and then four. Any recommendations for handling all scenarios?
Any and all advice is welcome. Thanks in advance!Doing some playing around on rubular.com and thinking the Regular Expression should be build this way instead:
^(\d+)\_(\d+)\_(\d+)\_(\d+)\_(\d+)$
Again, still looking for any additional guidance from more experienced individuals. Thanks! -
Regular expressions: the shorter the string, the longer the time to analyse
Hello there !
I've got a problem with regular expressions...
I analyse those two strings with the same regular expression, searching for the "message" word.
The first of them, which is much longer than the other one, is instantly analysed... but the second one takes about to one second !
Do you see the problem ? (I do not, as you can guess...).
I tried to put the same special characters in the two ones... but it still works slowly for the second one.
This is instantly analysed:
"Coucou----- Origin.a.l. .message -----From: clems= To: Cl�ment S=ent: Wednes=day, April 30, 2003 1:38 PMSubject: Fw: mail de test----- Original Message -----From: clemsTo: Cl�ment Sent: Wednesday, April 30, 2003 1:37 PMSubject: mail de testcoucou, ceci est un mail de t.e.s.t... !!!Clems.".matches("((.*\\W)*\\Q" + "message" + "\\E(\\W.*)*)")
This takes about to one second:
"This is a b message ubodyub.brHere s a href= http:www.tano.fr.fm the second linea.".matches("((.*\\W)*\\Q" + crit�reActuel.getLeMot(i).toLowerCase() + "\\E(\\W.*)*)")
Pleaaase, help ;)
ClementWell in fact everything seems to work... there was another problem...
My regular expression seems to be wrong and the code too...
I apologize... sorry for the waste of time.
See you later :) for my next wrong problem ! :))
Clement -
Regular expression - parse version number string
Hi,
I try to parse a string using regular expressions but id did not work correctly in all cases.
The string that i want to parse can have one of the following layout:
3.4.5.v20090305 or
3.4.5The first three parts have to be integer values, the last part can be a free string (which is optional).
I use the following code to parse the version number and extract the parts:
Pattern versionPattern = Pattern.compile("(\\d+)\\.{1}(\\d+)\\.{1}(\\d+)(?:\\.{1}(\\w+))?");
Matcher m = versionPattern.matcher(versionString);
if (!m.find()) {
throw new IllegalArgumentException("Version must be in form <major>.<minor>.<micro>.<qualifier>");
// assert that we matched every part
// three groups (without qualifier) or four parts (with qualifier)
int groups = m.groupCount();
if (groups != 4) {
throw new IllegalArgumentException("Version must be in form <major>.<minor>.<micro>.<qualifier>");
// extract the parts
major = parseInt(m.group(1));
minor = parseInt(m.group(2));
micro = parseInt(m.group(3));
qualifier = m.group(4);The above regular expression works in all cases that i tested, except one.
The follwoing string is accepted as correct input: (but it shouldn't)
3.4.5a.v20090305And i get the result:
major = 3
minor = 4
micro = 5
qualifier = a.v20090305
Thanks for help or suggestions :)
Best Regards,
Michaelheissm wrote:
Hi,
I try to parse a string using regular expressions but id did not work correctly in all cases.
The string that i want to parse can have one of the following layout:
3.4.5.v20090305 or
3.4.5The first three parts have to be integer values, the last part can be a free string (which is optional).
I use the following code to parse the version number and extract the parts:
Pattern versionPattern = Pattern.compile("(\\d+)\\.{1}(\\d+)\\.{1}(\\d+)(?:\\.{1}(\\w+))?");
Matcher m = versionPattern.matcher(versionString);
if (!m.find()) {
throw new IllegalArgumentException("Version must be in form <major>.<minor>.<micro>.<qualifier>");
// assert that we matched every part
// three groups (without qualifier) or four parts (with qualifier)
int groups = m.groupCount();
if (groups != 4) {
throw new IllegalArgumentException("Version must be in form <major>.<minor>.<micro>.<qualifier>");
// extract the parts
major = parseInt(m.group(1));
minor = parseInt(m.group(2));
micro = parseInt(m.group(3));
qualifier = m.group(4);The above regular expression works in all cases that i tested, except one.
The follwoing string is accepted as correct input: (but it shouldn't)
3.4.5a.v20090305And i get the result:
major = 3
minor = 4
micro = 5
qualifier = a.v20090305No, that can't be the output. Perhaps you have some old class files you're executing, because with the code you now posted, that can't be the result.
To verify this, execute this:
import java.util.regex.*;
public class Main {
public static void main(String[] args) {
String versionString = "3.4.5a.v20090305";
Pattern versionPattern = Pattern.compile("(\\d+)\\.{1}(\\d+)\\.{1}(\\d+)(?:\\.{1}(\\w+))?");
Matcher m = versionPattern.matcher(versionString);
if (!m.find()) {
throw new IllegalArgumentException("Version must be in form <major>.<minor>.<micro>.<qualifier>");
// assert that we matched every part
// three groups (without qualifier) or four parts (with qualifier)
int groups = m.groupCount();
if (groups != 4) {
throw new IllegalArgumentException("Version must be in form <major>.<minor>.<micro>.<qualifier>");
// extract the parts
System.out.println("1 -> "+m.group(1));
System.out.println("2 -> "+m.group(2));
System.out.println("3 -> "+m.group(3));
System.out.println("4 -> "+m.group(4));
}and you'll see that the following is the result:
1 -> 3
2 -> 4
3 -> 5
4 -> nullSome remarks about your pattern:
"(\\d+)\\.{1}(\\d+)\\.{1}(\\d+)(?:\\.{1}(\\w+))?"All the "{1}" can be omitted they don't add anything to your regex and are only cluttering it up. And you'll probably also want to "anchor" your regex using the start- and end-of-string-meta-characters, like this:
"^(\\d+)\\.(\\d+)\\.(\\d+)(?:\\.(\\w+))?$" -
Regular expression for middle of string
Bit of background. I'm getting both text (can contain numbers) and data (only numbers) from serial. Since I don't know which I'm receiving and when it starts/ends, I'm making the sender send "textSTART###textSTOP" where "###" is what I want to extract. ### can contain text, numbers, new line, carrige return or whatever.
The same for data: "dataSTART###dataSTOP", where ### contains only numbers.
I think I should use Match Pattern, but I don't know how to make my regular expression.
Any help is appreciated.
Solved!
Go to Solution.If the string does not contain anything outside these "delimiters" and there are exactly two per string, you could simply use scan strings for tokens. You can also add the "dataSTART/STOP" delimiters to the array to make it universal and look at the beginning of the raw string to determine if you are dealing with a "data" or "text" message.
Here's a quick draft.
LabVIEW Champion . Do more with less code and in less time .
Attachments:
TaggedText.png 10 KB -
Regular expression for Scan from String
I am trying to pick out three numbers with pattern $number1:number2:number3# from a stream, for instance 8.559509#$-1.686432:-2.427051:-7.281153#$-6.160924:-1.763356:
So far, I use "Scan from String" with Format string "$%f:%f:%f #". However I don't know how to ignore/delete the items before $. Would you like to help me with that? CheersYou know that your sequence of numbers begins with the $ and ends with the #, so you can separate them into groups first, then separate each number out.
Bill
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all. -
How to write regular expression to find desired string piece
Hi All,
Suppose that i have following string piece:
name:ali#lastname:kemal#name:mehmet#lastname:cemalI need
ali
mehmetI use following statement
SQL> select lst, regexp_replace(lst,'(name:)(.*)(lastname)(.*)','\2',1,1) nm from (
2 select 'name:ali#lastname:kemal#name:mehmet#lastname:cemal' as lst from dual
3 );
LST NM
name:ali#lastname:kemal#name:mehmet#lastname:cemal ali#lastname:kemal#name:mehmet#
SQL> But it does not return names correctly. When i change 5th parameter(occurence) of regexp_replace built-in function(e.g. 1,2), i may get ali and mehmet respectiveley.
Any ideas about regexp?
Note : I can use PL/SQL instr/substr for this manner; but i do not want to use them. I need regexp.
Regards...
MennanHi, Mennan,
You can nest REGEXP_SUBSTR withing REGEXP_REPLACE to get the n-th occurrence, like this:
SELECT lst
, REGEXP_REPLACE ( REGEXP_SUBSTR ( lst
, 'name:[^#]*#lastname'
, 1
, n
, 'name:(.*)#lastname'
, '\1'
) AS nm If the pattern occurs fewer than n times, the expression above returns NULL. -
Regular expression not working for String.split()?
hi, i have a String variable called 'table'.
It has a bunch of chunks of data seperated by whitespace, whether it
be spaces or carraige returns. Anyways, i want to split this up using
the String.split function. i want to split it around whitespace.
here is my code:
String codes[] = table.split("\s");
However, i'm getting back all nulls in the codes variable. What am i doing wrong?
thankssplit("\\s")\ is special both in Java String literals and in regex, so you need two of them.
You'll probably also have to take an extra step it you don't want regex to stop at newlines. I forget the details, so check the docs. -
I'm attaching a file that may help. Just remember this is my FIRST attempt at using NI/FeildPoint so things that would be obvious to the normal users more than likely would slide right by me. So I'll try and explain what the text contains as to make my problem more clear. I'm using a FP-1000, FP-AI-100, and a FP-TB-10. i'm creating a application where I'm using the 8 channels from the FP-AI-100 to monitor a control system ,that we manufacture. The control system is in an environmental chamber. I use the FP-TB-10 to monitor the temperature while in the chamber. The control system is ran for 4 hours under varing enviromental conditions while I monitor vital system voltages with the FP-AI-100. Now the application that i'm building starts with the obvious FP CREATE.VI and so forth I have no problem communicating with the FP's, but the information that I'm monitioring needs to be placed into a file with Headers describing the information below it. Now I use a "WHILE LOOP.VI" to monitor the FP-AI-100 & FP-TB-10 for the 4 hour period. but before that I create and open a file where I use a "CONCATENATE STRINGS.VI" to enter the headers I need. I do this by CONSTANTS, CONTROLS, TABs, AND CARRIAGE RETURN being entered into the "CONCATENATE STRINGS.VI" in the order I want them to appear. I use ROW 1 to enter (OPERATOR:with a CONSTANT) an a (CONTROL so the operator may enter his name and be recorded into the file) using a TAB to seperate Columns and a CARRIAGE RETURNto drop down to ROW 2 for the next headers. I use header names and TABs to seperate the columns. This part works great. I end up with ROW 1 having the operator information then ROW 2 having the headers for all the channels I'm using to monitor the control system with in their own column. The trouble happens when I write to this file during the "WHILE LOOP". The information recorded for DATE:, TIME:, and Channel 0 of the FP-AI-100 end up right under their corresponding header on ROW 3, but the rest of the data ends up on ROW 4 in column 3 and goes down many rows with some of the data not being stored at all. It varies on how many rows are used starting at ROW 4 but hey always stay in column 3. I use the "FP READ.VI" outputing to a "ARRAY TO SPREADSHEET STRING.VI" outputing to a "CONCATENATE STRINGS.VI" for each channel within the "WHILE LOOP" then into the "WRITE.VI". I use the "CONCATENATE STRINGS.VI" to place my data OR atleast I thought you could do that some how I'm not quit doing something write either there is a sampling/timing issue or writing to file issue where things are being confused in the "WHILE LOOP" if someone know a better route to perform what I'm tring here I would be interested. Its not like I'm not giving it the old colledge try here but without proper training and the vagness of the manuals it's difficult to understand what every connection actually does.I'm tring though for everyone who happens to fill pity for me
Thanks for your help
John Morris
Glendinning Marine Product, Inc.
Attachments:
ALLchannels 273 KB> I appreciate your effort to help me, but there is still a slight cloud
> in front of my eyes here.(I must mention that I'm using Labview 5.1
Oh, to bad. I'm using LV 6,02 and tried to save the application as LV5.1,
but it didn't work.
> Lets start with the easy one which is the SECOND main thing you
> wanted to mention. In my application I used individual Create Tag.vi's
> "so your saying that I can use just one Create Tag.vi and one Read.vi
> and what ever I use to display the values will automatically to show
> the individual channels" in other words if I use a "Indicator(DBL)"
> comming out of the Read.vi what ever I use in the "PANEL" layout will
> expand to show all 8 channel if I was using a FP-AI-100? Cool...
Allmost right. The 8 channels come out as 1D-array, ch0...ch7.
> #1--How do I change the delimiter (TAB) to a delimiter (comma) in a
> Array to Spreadsheet String.vi?
> ...cut
I don't use this Spreadsheet VI, because files coming out there allways
start this time consuming EXCEL wizzard. Because of this, I programmed my
own CSV-conversion vi. Maybe you could just use a common texteditor, like
wordpad and put the csv-examples from my last reply down to a text file
and rename it to *.csv. Texteditors terminate lines with "\r\n" by
default, so this is a very quick way for testing.
> FP_Analog_Logging example to record all eight channels it uses a Array
I didn't find the vi you metione above, but there is another good one:
Look at examples\FieldPoint\DataLogging\FP Logger.vi.
In a little case structure, at "false", there is a function called "Format
into string".
Pop up on the format string and adjust >>'\' Codes Display<<.
Then you change the format string into: %.;%-f%s
A Tab string is connected to the lower input of this function. Replace
this one with a comma.
That should do.
>
> #2--If using just one Create Tag.vi and one Read.vi and I have the
> Item Name listed as ALL I take it that the information comming out of
> the Read.vi is data for each channel in a String format starting with
> channel 0 and ending with channel 7 for the FP-AI-100.
Yes, just as explained above. If you put a indicator at the output to
display the values, you can expand the display to show all 8 channels, but
you can't name induvidual cells. In a array, all cells have identical
named labels. If you want to name the individually, you have to attach the
array to cluster function and put the indicator after this one. Enable
labe display and name the output values individually.
> #3--Now I use the following to "Format String" in the Array to
> Spreadsheet string.vi (%.4f)but I don't see anyway of changing the
> delimiter from (TAB) to (COMA)
Explained above.
> #4 you stated text strings need a "as prefix and sufix" and each
> string is seperated by a coma, a period is used as decimal number
> separator and lines have to be terminated by my question is
> WHERE IS THIS ACCOMPLISHED? WHAT VI OR WHAT CONNECTOR PIN?
Well, modifying strings are done with string functions.
Above, as I explained how the sample FP Logger.vi can be modified to do
the job for numbers. The pre- and suffixing with ", you only need for
strings, which EXCEL should interpret a string and as nothing else as a
string, even if there's a number inside. You usually need this only for
headers. So its easyest, if you just write your string into a string
constant or control and concatenate it to the previous csv-file contents.
Oh, I just see by looking at the above mentioned example... Inside the
case structure, but in the "true" case, there are error messages
concatenated to the logfile. At this point it is importent, to use " for
integrating the message into the CSV file, because a error message usually
looks like this: >> ERROR 2345 in vi yxz <<
Here you have text and number strings mixed in one line. EXCEL does not
know, if it should interpret the number inside the error line as separate
number, separating the line into three colums i.e. string before number,
number and string after number. So tell EXCEL by putting a " before and
after the line each.
For this, expand the Format To String function by one input, move down all
connections, to be able to insert a string constant with a " to the first
argument connector. Change the contents of the string constant at the
bottom argument from tab to ", (quotation mark AND comma)
> #5 You gave me an example of what a 3 column header could look like:
> "col0","col1","col2"\r\n Now is this something that you enter
> somewhere cause I know that \r is carriage return and \n is newline so
> I take it that the above is entered somewhere maybe in the Write.vi to
> the connector called Header (F)? See this is what confuses me because
> NI manuals have no examples of certain connectors types being used or
> any reference as to how they manipluate data with there varing type
> inputs. Or maybe I'm just missing them.
The example I mentioned above help here to.
Look at the Write File function. This function receves data from a
function named concatenate strings. Expand this function to have one more
spare input at the bottom. Create a string constant. Switch the constant
display to "\" mode. Enter "col0","col1","col2"\r\n into the constant.
Connect the constant to the spare input.
Doing this, every dataline in the csv file is followed by
"col0","col1","col2"\r\n .
I wish you a nice weekend,
Rainer Ehrt
Maybe you are looking for
-
Payment Program Creation Date and User (is this in any table in SAP R/3)?
Dear Experts! The treasury guy asked me whether there would be a way to recover the "Payment Program" Creation Date and Created by (User) from Payment Program Executions (F110 transaction). I searched on the REGU* tables and I didn't find out this in
-
Frequently get " mozilla firefox not responding" messages while already on yahoo page. When trying to trouble shoot on support page by going to "check with mozilla on the status of your plug ins" I am blocked by a rotating grey circle. Main problem i
-
Nokia 6111 camera flash wont turn off
Hello, can someone help, ive got a nokia 6111 and the flash wont turn off. I've went into the camera function and turned the flash off but its still on! its very annoying can someone help?
-
Can I transfer iTunes music from my iPad to a Kindle Fire?
Can anyone tell me how I can transfer purchased iTunes music from an iPad mini to a kindle fire?
-
This happens for all updates, namely, Bridge, Extension Manager, Photoshop and Camera Raw modules.