string management - Delstr
Belias
Member Posts: 2,998
i think i'm doing a stupid error, but i can't catch it...can you please suggest me?
i launch this function
passing this string as TXTLocLine parameter
N;Fattura FV0701833;01833;20080422;01833;20080422;;Master Merci;Account Merci;;1;3;IV20;123,00;A;24,60;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
and i expect to receive this as result (no more 24,60 and a '-' added)
N;Fattura FV0701833;01833;20080422;01833;20080422;;Master Merci;Account Merci;;1;3;IV20;123,00;A;;-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
but instead i receive (24,6 instead of 24,60)
N;Fattura FV0701833;01833;20080422;01833;20080422;;Master Merci;Account Merci;;1;3;IV20;123,00;A;24,6;-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
i think i'm missing some positions in the string but i'm tired to change the numbers randomly and try...
i launch this function
INTDotCommaCounter := 0;
INTIFrom := 0;
FOR i := 1 TO 1024 DO BEGIN
IF TXTLocLine[i] = ';' THEN
INTDotCommaCounter := INTDotCommaCounter + 1;
IF INTDotCommaCounter = 15 THEN
INTIFrom := i;
IF INTDotCommaCounter = 16 THEN
INTITo := i;
IF INTDotCommaCounter = 17 THEN BEGIN
TXTLocLine := INSSTR(TXTLocLine,'-',i);
END;
END;
TXTLocLine := DELSTR(TXTLocLine,INTIFrom,INTITo-INTIFrom);
EXIT(TXTLocLine);
passing this string as TXTLocLine parameter
N;Fattura FV0701833;01833;20080422;01833;20080422;;Master Merci;Account Merci;;1;3;IV20;123,00;A;24,60;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
and i expect to receive this as result (no more 24,60 and a '-' added)
N;Fattura FV0701833;01833;20080422;01833;20080422;;Master Merci;Account Merci;;1;3;IV20;123,00;A;;-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
but instead i receive (24,6 instead of 24,60)
N;Fattura FV0701833;01833;20080422;01833;20080422;;Master Merci;Account Merci;;1;3;IV20;123,00;A;24,6;-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
i think i'm missing some positions in the string but i'm tired to change the numbers randomly and try...
0
Answers
-
More info, i debugged the code:
within the loop, intifrom variable equals 98, but when performing delstrfunction, it equals 102... :-k :-k
can it be caused by insstr instruction??
EDIT: SOLVED!! I know it was really stupid...INTdotCommacounter is 15 until the next ';', so the value of intfrom is overwritten every time...
#-o0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K 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
- 324 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