FWMariaDB y XBrowse - Consulta Query

FWMariaDB y XBrowse - Consulta Query

Postby jose_murugosa » Tue Dec 21, 2021 11:09 am

Code: Select all  Expand view

#include "Fivewin.ch"
#include "xbrowse.ch"

function PlanillaMantDiarios( oCn )
     LOCAL oDlg, oFont1, oFont2, oFont3, oBrw, oRs, wmes, wanio, csql, oGet:={}
     LOCAL ii
     wmes := 11
     wanio:= 2021
     oGet:=Array(2)
     
     cSql := "SELECT * FROM mantenimientos JOIN planilla JOIN maquinas JOIN sectores ON ( mantenimientos.mant_id = planilla.plaMant_id and mantenimientos.mantMaq_id = maquinas.Maq_id and mantenimientos.mantSector_id = sectores.Sector_ID ) WHERE ( planilla.pla_mes = 11 and planilla.pla_anio = 2021 )"
     oRs := oCn:RowSet( cSql )

     DEFINE DIALOG oDlg RESOURCE "DLG_PLAMDIARIOS" TITLE "Planilla de Mantenimientos Diarios"
     
          REDEFINE GET oGet[1] VAR wmes id 101 picture "99" of oDlg
          REDEFINE GET oGet[2] VAR wanio id 102 picture "9999" of oDlg

          REDEFINE XbROWSE oBrw id 201 of oDlg DATASOURCE oRs         ;
               COLUMNS "mant_nombre", "pla_mes", "pla_anio", "Sector_Nombre", "D1", "D2",                               ;
                    "D3",  "D4",  "D5",  "D6",  "D7",  "D8",  "D9",  "D10", "D11", "D12",                               ;
                    "D13", "D14", "D15", "D16", "D17", "D18", "D19", "D20", "D21", "D22",                               ;
                    "D23", "D24", "D25", "D26", "D27", "D28", "D29", "D30", "D31"                                       ;
               HEADERS "Mantenimiento:", "Mes:", "Año:", "Sector:", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12",     ;
                    "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"   ;
               SIZES 320, 30, 40, 120, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,                 ;
                    20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ;                                                        
               FASTEDIT
 
          WITH OBJECT oBrw
               :nEditTypes    := EDIT_GET
               :SetChecks( nil, .t. )
               :nfreeze := 4
               :lEdit:=.t.
          END WITH
         
     ACTIVATE DIALOG oDlg CENTER
     oRs:Close()
RETURN nil
 



I have this code, it allows me to display the information of a query that includes 4 tables, but only allows me to edit the main table.

I have implemented a solution by storing the query in a temporary table, but I have several cases like this in a development and I would be interested to know if it is possible to edit all the tables at the same time with xbrowse, if it can only be done by means of a temporary table or if there can be a better solution.

Thank you.


Tengo este código, me permite visualizar la información del query que incluye 4 tablas, pero solo me permite editar la tabla principal.

He implementado una solución poniendo el query en una tabla temporal, pero tengo varios casos como este en un desarrollo y me interesaría saber si se puede editar sobre todas las tablas a la vez con xbrowse, si solo puede hacerse mediante una tabla temporal o si puede haber una mejor solución.

Gracias.
Last edited by jose_murugosa on Wed Dec 22, 2021 1:31 pm, edited 1 time in total.
Saludos/Regards,
José Murugosa
FWH + Harbour + Bcc7. Una seda!
User avatar
jose_murugosa
 
Posts: 1145
Joined: Mon Feb 06, 2006 4:28 pm
Location: Uruguay

Re: FWMariaDB y XBrowse - Consulta Query - Mr. Rao

Postby jose_murugosa » Wed Dec 22, 2021 10:13 am

Alguna sugerencia?
Saludos/Regards,
José Murugosa
FWH + Harbour + Bcc7. Una seda!
User avatar
jose_murugosa
 
Posts: 1145
Joined: Mon Feb 06, 2006 4:28 pm
Location: Uruguay

Re: FWMariaDB y XBrowse - Consulta Query - Mr. Rao

Postby jose_murugosa » Wed Dec 22, 2021 1:31 pm

Según la documentación de FWMariaDB de FWH:

Also, columns which are computed or derived from joined tables are also flaged as readonly.
It is obvious that single tables can be edited/modified easily.

Traducción
Además, las columnas que se calculan o derivan de tablas unidas también se marcan como de solo lectura.
Es obvio que las tablas individuales se pueden editar / modificar fácilmente.

Esto me queda muy claro.

Por medio de una tabla temporal es una solución posible, que es la que he implementado por consejo de cmsoft, (muchas gracias por la ayuda)

Solo me preguntaba si habría una mejor manera.
Saludos/Regards,
José Murugosa
FWH + Harbour + Bcc7. Una seda!
User avatar
jose_murugosa
 
Posts: 1145
Joined: Mon Feb 06, 2006 4:28 pm
Location: Uruguay


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 64 guests