are in *.FMG ? that's right on main.fmgAUGE_OHR wrote: ↑Sat Aug 31, 2019 8:59 pm hi,
thx again for your help an demo code.
i saw thatare in *.FMGCode: Select all
WIDTHS { 100,300,100,150,400} HEADERS { 'Code' , 'Name' , 'Salary' , 'Creation' , 'Description' }
there are a lot of PRIVATE in your new code and it is still fix on given Table.
i want to use GRID for any Table so i have to modify your code as i did in my 1st Sample.
to get WIDTHS and Header i use this code with Xbase++
Code: Select all
METHOD PGSql:dbStruct( cTable ) LOCAL aStruct := {} LOCAL oStruct, i, iMax LOCAL cField, cType, nLen, nDec LOCAL cWhere := "" LOCAL cData_type := "" ::exec( "SELECT column_name, data_type, character_maximum_length, numeric_precision, numeric_scale " + ; "FROM information_schema.columns WHERE table_name='" + cTable + "'" + ; "ORDER BY ordinal_position" ) oStruct := ::result iMax := oStruct:rows FOR i = 1 TO iMax cField := oStruct:GetValue( i - 1, 0 ) cData_type := UPPER( ALLTRIM( oStruct:GetValue( i - 1, 1 ) ) ) DO CASE CASE cData_type = "BOOLEAN" cType := "L" nLen := 1 nDec := 0 CASE cData_type = "CHARACTER" cType := "C" nLen := oStruct:FieldGet( i - 1, 2 ) nDec := 0 CASE cData_type = "DATE" cType := "D" nLen := 10 nDec := 0 CASE cData_type = "TEXT" * cType := "M" cType := "C" nLen := oStruct:FieldGet( i - 1, 2 ) nDec := 0 CASE cData_type = "NUMERIC" cType := "N" nLen := oStruct:FieldGet( i - 1, 3 ) nDec := oStruct:FieldGet( i - 1, 4 ) CASE cData_type = "INTEGER" cType := "N" nLen := oStruct:FieldGet( i - 1, 3 ) nDec := oStruct:FieldGet( i - 1, 4 ) CASE cData_type = "SERIAL" cType := "N" nLen := oStruct:FieldGet( i - 1, 3 ) nDec := oStruct:FieldGet( i - 1, 4 ) // byteA -> HEX -> Bitmap // CASE cData_type = "BYTEA" cType := "B" nLen := 10 nDec := 0 // large Object // CASE cData_type = "OID" cType := "O" nLen := 10 nDec := 0 OTHERWISE MSGBOX( "unknown type " + cData_type ) cType := "C" nLen := 1 nDec := 0 ENDCASE AADD( aStruct, { cField, cType, nLen, nDec } ) NEXT RETURN ( aStruct )
there are a lot of PRIVATE in your new code and it is still fix on given Table.
i want to use GRID for any Table so i have to modify your code as i did in my 1st Sample.
there are a lot of PRIVATE in your new code and it is still fixed on given Table? variables for form I use private
i want to use GRID for any table so i have to modify your code as i did in my 1st Sample? you have to do manual or use a function to return the amount of fields you can use any already used if it works, so I put the example of using a vector in main.fmg form due to the ease of manipulating this data being manual or automated.