Hi!
I would like to sort the table by field name (or number) which is set as a variable value.
Now used this option:
INDEX ON STR(99999999.9999999-FIELDGET(ff),19,7) TO Mrk_funi
But it turned out that it doesn't work for numeric fields that specify the integer values 0 and 1. In the other cases it works fine.
Sort numeric integer error does not cause, but the result is wrong.
Tried this:
mFN = FIELDNAME(ff)
INDEX ON STR(99999999.9999999-&mFN,19,7) TO Mrk_funi
But it throws error.
And such a simple option is also not working:
INDEX ON STR(99999999.9999999-FIELDNAME(ff),19,7) TO Mrk_funi
The data type in the field numeric N7
Error occurs when a field numeric integer. if you make the decimals no zeros, then everything is working fine.
Which In Alaska is the data types for databases: the "Integer" and "Short integer"?
Indexing by the specified field
- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
Indexing by the specified field
- Attachments
-
- Безымянный.jpg (69.77 KiB) Viewed 6932 times
Re: Indexing by the specified field
Hi,
You can use a function for this.
You can change this to:
In the function you can controle everything.
You can use a function for this.
Code: Select all
INDEX ON STR(99999999.9999999-FIELDGET(ff),19,7) TO Mrk_funi
Code: Select all
INDEX ON calculatevalue(ff) TO Mrk_funi
Code: Select all
function calculatevalue(ff)
local nValue := fieldget(ff)
if nValue
...
else
....
endif
return STR(99999999.9999999-nValue,19,7)
- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
Re: Indexing by the specified field
Thank you very much! Based on this, I did what I need, and everything works fine:
Code: Select all
FUNCTION CalculateValue(ff)
local nValue := FIELDGET(ff)
mKey = ''
IF FIELDDECI(ff) = 0 // Целые
mKey = STR(99999999-nValue,15)
ELSE
mKey = STR(99999999.9999999-nValue,15,7)
ENDIF
RETURN(mKey)