Dynamic columns

Discussions specific to Team Developer 5.1.

Dynamic columns

Postby ILYA » Wed Feb 20, 2008 1:40 am

Hi! I try to create dynamic columns in my table by the following code:

Code: Select all
If sType = 'STRING'
   Set nColID = SalTblCreateColumnEx( hWndItem, 1, 2, sCaption, nLength, DT_String )
Else If  sType = 'DATE'
   Set nColID = SalTblCreateColumnEx( hWndItem, 1, 2, sCaption, nLength, DT_DateTime )
   Call SalFmtSetFormat( SalNumberToWindowHandle( nColID ), FMT_Format_Date )
   Call SalFmtSetInputMask( SalNumberToWindowHandle( nColID ), 'dd/mm/yyyy' )

But I can't set date format for the column with DT_DateTime. By default the value in the cell displays as '01-JAN-08', but I want '01/01/2008'. The function SalFmtSetFormat/SalFmtSetInputMask doesn't work. Is it a bug or I do smth wrong?

TD 5.1 & Windows Vista Business
CJSC "Macomnet"

Techinfo:
TD 5.1 SP6 Build 8873
Windows XP SP3
ILYA
 
Posts: 52
Joined: Thu Feb 07, 2008 9:23 am
Location: Russia, Moscow

Re: Dynamic columns

Postby ILYA » Thu Feb 21, 2008 7:32 am

One more bug:
Code: Select all
...
Set nColID = SalTblCreateColumnEx( hWndItem, 1, 2, 'Dynamic column', 100, DT_LongString )
..

I try to create column DT_LongString datatype. The program runs, but I don't see the column! After call SalTblCreateColumnEx nColID = -1, that indicates an error. But I need DT_LongString column, cause I populate an Oracle function return result into it. Is it possible to create a LongString column?
CJSC "Macomnet"

Techinfo:
TD 5.1 SP6 Build 8873
Windows XP SP3
ILYA
 
Posts: 52
Joined: Thu Feb 07, 2008 9:23 am
Location: Russia, Moscow

Re: Dynamic columns

Postby Jeff Luther » Thu Feb 21, 2008 9:16 am

First, Ilya, you can see in TD help what column types are allowed:
nDatatype Number. One of the constants DT_String, DT_Number, or DT_DateTime. Any other value will cause an error.


If you need a Long String then you will need to add one in design-time for your TW (or fetch into a var. of type Long String, then assign that to your string TW column).

Second, your use of hWndItem as the first parameter is suspect to me, esp. since I cannot see where your SAL code is placed. If it is inside a msg. sent to the TW then it is ok; if it is somewhere else, be careful! since hWndItem refers to the curent *object* with the focus and that could be anywhere: pushbutton, field with the focus, etc.

I think it is better, when showing a little SAL code like you have, to provide us the context of the code; namely, in a function, msg., etc.
Jeff Luther
 

Re: Dynamic columns

Postby niels » Fri Feb 22, 2008 8:57 am

ILYA wrote:
Code: Select all
   Call SalFmtSetInputMask( SalNumberToWindowHandle( nColID ), 'dd/mm/yyyy' )

But I can't set date format for the column with DT_DateTime. By default the value in the cell displays as '01-JAN-08', but I want '01/01/2008'. The function SalFmtSetFormat/SalFmtSetInputMask doesn't work. Is it a bug or I do smth wrong?

In earlier versions of TD "mm" is used for minutes and "MM" is used for months. Try changing the format to 'dd/MM/yyyy' and see if it helps.

EDIT: That should be SalFmtSetFormat () instead of SalFmtSetInputMask().
niels
 
Posts: 17
Joined: Fri Jul 06, 2007 7:51 am
Location: Bremen, Germany

Re: Dynamic columns

Postby ILYA » Mon Mar 24, 2008 3:11 am

I still can't set date format in table column. The code is:
Code: Select all
Set nColID = SalTblCreateColumnEx( hWndItem, 1, 2, 'Dynamic date column', 20, DT_DateTime)
Set hCol = SalTblGetColumnWindow( hWndItem, nColID, COL_GetID )
Call SalFmtSetFormat( hCol, FMT_Date_DMY )
Call SalTblPopulate(hWndItem, hSqlMain, lsStmt, TBL_FillAll)

Is it possible to set format of the dynamic column?
CJSC "Macomnet"

Techinfo:
TD 5.1 SP6 Build 8873
Windows XP SP3
ILYA
 
Posts: 52
Joined: Thu Feb 07, 2008 9:23 am
Location: Russia, Moscow

Re: Dynamic columns

Postby jmgemperle » Thu Mar 27, 2008 9:38 am

Hi,

I blieve there is couple issues there... need to check further and come back to you ASAP.

JM
User avatar
jmgemperle
 
Posts: 886
Joined: Thu Feb 15, 2007 1:57 am
Location: Leiden The Netherlands

Re: Dynamic columns

Postby FRBhote » Thu Nov 19, 2015 4:01 am

So is there a solution to this?
User avatar
FRBhote
 
Posts: 977
Joined: Mon Jul 07, 2008 7:38 am
Location: Hyderabad, India


Return to Team Developer 5.1

Who is online

Users browsing this forum: No registered users and 2 guests