Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 1 Jahr, 4 Monaten
Letzter Beitrag:
vor 1 Jahr, 4 Monaten
Beteiligte Autoren:
Scott Daughtry, Al, Fabrice Harari, Piet van Zanten

ccRespectNumeric - Where to insert it?

Startbeitrag von Scott Daughtry am 10.01.2017 03:14

My table control is populated via a query; the invoice column (which is defined as a text field in the Analysis) is not respecting numeric values, so invoice #100 is being listed before invoice #99.

When I tried adding the COLUMNNAME..SortOption = ccRespectNumeric (replacing COLUMNAME with the actual Table Control's column name associated with the invoice field) to the code the problem still exists (i.e. 100 is displayed before 99). When I opened the query that 'feeds' the table control I don't see anything on screen pertaining to respecting numeric sorting.

What am I missing that is so obvious but hidden from me ?


Hello Scott

Set the sort process in the table editor.
In the "General Tab" click on the Invoice column
Under the "Sort" tickbox there is a "Sort Options" button
Just click the "Customize Sort" tick box and the defaults as they are should be ok for what you want.


von Al - am 10.01.2017 04:02
Hi Al,

The 'Sort Options' button is greyed out.. probably because I have to fill the table control via a query so I can use the "TPLC_ChoosePeriod" template from the WD Full Application?

von Scott Daughtry - am 10.01.2017 04:37
Hello Scott

In that case use the TableSort command, try


von Al - am 10.01.2017 04:52
Even through the autofill will allow me to enter the line like this:

at runtime it bombs with the error below:

*-------------- Error
Error at line 4 of End of initialization of WIN_Table_Jamietrak process.
TableSort function called.
Parameter #3 is not a string.

----- Technical Information -----

Project : JamieTrak

WL call:
Process of 'End of initialization of WIN_Table_Jamietrak' (WIN_Table_Jamietrak), line 4, thread 0
'TableSort' function, syntax 0

What happened?
Parameter #3 is not a string.

Error code: 10030
Level: fatal error

Dump of the error of 'wd210obj.dll' module (21.0.432.1).
Identifier of detailed information (.err): 10030
Debugging information:
Fonction (1,58)
Additional Information:
End of initialization of WIN_Table_Jamietrak (WIN_Table_Jamietrak), line 4
End of initialization of WIN_MENU (WIN_MENU), line 3
EIT_DATEHEURE : 09/01/2017 22:10:34


-Check whether the given parameter is of type string.

The Windev21 online help only shows that the TableSort function can accept up to 16 column names and if they are ascending/descending... it doesn't show the various parameters like ccRespectNumeric


von Scott Daughtry - am 10.01.2017 05:14
Hello Scott

Sorry that did not work, the syntax is correct for ListSort() only

Back to the beginning then.
According to the help, the..SortOption merely sets up the sort parameter and must be followed by an actual TableSort() Command.

COL_Name..SortOption = ccLexicographicOrder
TableSort(TABLE_Name, "+COL_Name")

Did you have that in your original code ?


von Al - am 10.01.2017 05:23
Hi Al,

I will give that a try!!

Most importantly, thank you for always responding to my pleas for help - I appreciate you!

von Scott Daughtry - am 10.01.2017 05:43
Hello Scott

Thanks - it has been a bad day with V21 and your question was a nice diversion :)


von Al - am 10.01.2017 05:46
Hi everybody

@scott: could you simply try to set the control table column as numeric? As your content is numeric (even if stored as a string), it should convert fine and be sorted the way you want.

Now, of course, there is also the question of knowing where the current SORT is coming FROM. If your table is linked to the query or file and the sort orer is defined as coming from the there, nothing you change in the table will work.

Best regards

von Fabrice Harari - am 10.01.2017 11:50
Hi Fabrice,

Unfortunately the client has a need to insert the word 'CASH' into the invoice number instead of using a traditional auto-incrementing/unique integer for that field... not the way I recommend doing it, but as the saying goes 'the customer is always right' and they have done it this way for decades.. so I have to leave the field's definition as TEXT..

The other thought I was playing around with is padding the Invoice # field when the OK button is clicked on the form with leading zeroes... pseudo code being

// 6 digit Invoice number length
if InvoiceNbr = 'Cash'
.. do nothing
if InvoiceNbr < 10
! pad with 5 leading zeroes
if InvoiceNbr > 9 AND < 100
! pad with 4 leading zeroes

and so on....

That would likely fix this odd problem... in a convoluted way .. thoughts?

von Scott Daughtry - am 10.01.2017 14:28
Hi again

I was NOT talking about changing the analysis, just the table column type...

Best regards

von Fabrice Harari - am 10.01.2017 14:40
Hi Fabrice,

I think I tried changing the table control's column for that field but I will try it again tonight when I get home from work. If I set it to display as Numeric, will database entries with 'CASH' saved to that field still display 'CASH' in the table control or will it be blanked out?


von Scott Daughtry - am 10.01.2017 15:14
Hi Scott,

You can use WL functions in the query editor.
You can add a calculated item by clicking the corresponding button in the query editor.
Then you set the radio button to "WL language functions" and select "Val".
You should end up with something like WL.Val(myfile.myitem) in the function.
Name the calculated item something like InvNum and sort the query on it.
"CASH" will be zero then.
That's it.
Just check that the enduser on the deployment server has the "Rights to run stored procedures and/or WLanguage commands in the queries" checked on the rights tab of the database .
You might also use an SQL function in the calculated item like CONVERT.

BTW to use the sort function in tables you should check "loaded in memory" for the table data.

Best regards,

von Piet van Zanten - am 10.01.2017 17:29
Hi Scott,

all CASH entry will be blanck if column is set to numeric... If that is not what you want then you need to use a hidden numeric column in which you set 0 for cash and the numeric value otherwise, then sort on this column. As you display the text value, you'll get your cake and it i too...

Best regards

von Fabrice Harari - am 10.01.2017 19:06
Nothing I tried with the table worked, so I took the easy way out and made use of the excellent NumToString() function - I added this code into the form's SAVE button and my problems are solved:

// Format the Invoice number with padded zeroes
IF EDT_InvoiceNbr = "cash" THEN
// do nothing
// pad the invoice number with leading zeroes
nGsLocNum = EDT_InvoiceNbr
Jamietrak.InvoiceNbr = NumToString(nGsLocNum, "05d")

Thank you very much for your help - hopefully this information exchange will benefit other WD programming newbies (I certainly fit into that category).

von Scott Daughtry - am 11.01.2017 03:17
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.