How Can i Delete blank char in a string???

TnTpureheart
Member Posts: 7
Hi i'm new of the forum and i need your help! i'm trying in all the way to delete the white spaces in a string!!but i can't find a solution!! i have imported datas with a dataport in a table, now i want to remove white spaces in the field "VAT Registration No."!!! i used the code below...
what's wrong?
why it doens't work? please help me to find a solution
blanktext := '';
FOR i :=1 TO STRLEN("VAT Registration No.") DO BEGIN
IF "VAT Registration No." <> ' ' THEN
BlankText := BlankText + FORMAT("VAT Registration No.");
END;
"VAT Registration No." := BlankText;
what's wrong?
why it doens't work? please help me to find a solution
blanktext := '';
FOR i :=1 TO STRLEN("VAT Registration No.") DO BEGIN
IF "VAT Registration No." <> ' ' THEN
BlankText := BlankText + FORMAT("VAT Registration No.");
END;
"VAT Registration No." := BlankText;
0
Comments
-
Try this:
FOR i := 1 TO STRLEN("VAT Registration No.") DO BEGIN IF COPYSTR("VAT Registration No.",i,1) <> '' THEN BlankText := BlankText + COPYSTR("VAT Registration No.",i,1); END;
No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)0 -
It doesn't work... :-(
how is it possible?
is it couse the datas come from a dataport?0 -
Check out the on-line help for the DELCHR function!Kind regards,
Jan Hoek
Product Developer
Mprise Products B.V.0 -
](*,)
Yes i've already tried even with DELCHR function...
help help :-(0 -
The strange thing is that the white space is not recognized like a space...
in the txt file i used for importing data some character are like this "ÿ" and then when i import them they become " " so i think that even if they become white spaces, after importing, they are not the character " "...
Anyone have an idea?0 -
You could use a hex editor to find out the ASCII value of this character. Once you find out, you can use DELCHR to remove that specific character.Kind regards,
Jan Hoek
Product Developer
Mprise Products B.V.0 -
OK i found the ascii code is FF now the correct sintax is this?
DELCHR(String,'=',FF);
thanx thanx thanx0 -
do this
create a variable myChar of type Char. and another variable for mytext as text
in your code
do this
MyChar := 255; /note 255 is decimal for hex FF
Mytext := format(MyChar);
DELCHR(String,'=',Mytext);0 -
Oh thanxs a lot to all of u!!!
now it works!! i have another question...Can i in a dataport for importing data put some code to manipulate all the field for removing a character without putting the code in every dataport fields??
:?0 -
on beforeimport trigger you can write your code.
Also use an array to put the data in first. Then write a forloop to go through the array and run your delete chr function. Then assign the array to your record fields.0 -
ara3n wrote:do this
create a variable myChar of type Char. and another variable for mytext as text
in your code
do this
MyChar := 255; /note 255 is decimal for hex FF
Mytext := format(MyChar);
DELCHR(String,'=',Mytext);Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions