Anybody out there who has an idea of how to convert a string in Navision to a BIGINT ? The problem is that not two strings may have the same BIGINT expression. I need to cater for character swaps as well, so a checksum will not really be sufficient.
Hi Thomas, only a little idea:
ConvertStringToBigint(piString : Text) retBigInteger : BigInteger MaxLen := 8; retBigInteger := 0 ; IF STRLEN(piString) <= MaxLen THEN BEGIN piString := INSSTR(piString,COPYSTR(' ',1,MaxLen-STRLEN(piString)),1); FOR i := 1 TO MaxLen DO retBigInteger := retBigInteger * 256 + piString[i]; EXIT(retBigInteger); END ELSE BEGIN MESSAGE('String %1 too long.',piString); EXIT(0); END;i, MaxLen are typi integer But why do you have to convert string to Bigint? br Josef Metz
The string can be up to 250 characters. I need it for comparison reasons. I need to compare two records (actually recordrefs) with each other. Of course the easiest way to do this is to compare just the Format(FRef) of each field. But this is also the slowest as I have to loop through a very large number of records. All other data types do have a kind of integer expression or are easily convertable. Option, Integer and BigIntager are already BIGInteger ROUND(Decimal * 10000000,1) is a BIGINT BLOBS have a size (BIGINT) Date - Date = BIGINT Time - Time = BIGINT DateTime - DateTime = BIGINT only strings (text and code) are different. I was already thinking about a MD5 from the Navision Hash 1.0 automation server, but that returns a string again [:D] Integ
If you already have considered checksum, but the position is a problem, you could factor in the position of the character as well. Not sure it will be faster than comparing 2 strings. But then again that depends on what/how your comparison code does/works.