Hi all,
I am having a hard time using STRPOS() to compare a CODE and a TEXT variable.
Here's what I have:
VAR:
myTxt TEXT(80)
myCode CODE(20)
myCode:= '329021277';
myTxt:= '329021277/5504';
using STRPOS(myTxt, myCode) always returs 0!!
I've already used the FORMAT function to cast one type to another but keeps on returning 0.
I will try to parse both variables char by char...but I would like to know the reason why this happens.
Thank you all.
Best regards.
Comments
Re-examine what you really coded.
The code I posted is working fine... I oversimplified my error and mislead you all (even myself ).
I have a few customized fields in my "Job Ledger Entry" table and one of them is a Text(80).
I have an automated process that imports data from a CSV file and saves it in a table (let's call it "Imported Lines"). Then all that imported data is validated and if it is ok is posted in the "Job Journal Line". Finally, using the "Job Jnl.-Post" codeunit post that data in the Job Ledger Entry.
All those posted records have only one field that can be edited (in the Job Ledger Entry table) by the user and a few times its content is modified.
In a process I designed I am comparing records in the Job Ledger Entry with records in the "Imported Lines":
The JobLedgEntry."Transport Num." is a Text(80) and the ImportLines."Transport Num." is a Code(20).
I tried debugging with a message box displaying the return value of STRPOS and that message displays 0... The values I posted before (in the myTxt and myCode)are values that exist in both tables.
I tried casting the value of the text variable to a code variable and use that one in the SRTPOS with no luck.
Thanks once again.