locked
Help with LINQ Query... returning decimal... but i need string... RRS feed

  • Question


  • How I can make a query to the table simpla I have linked using WCF RIA, where there are counters invoices, orders, estimates, and filter by (invoice) and the corresponding series of billing?

    Thank you!
    Monday, August 26, 2013 2:32 PM

All replies

  • This is the table. On Yellow, a value i need, to add on other table an invoice.

    Can any person, help me to linq query ? Empresa = 01 (Enterprise Active) TIPODOC = 2 and SERIE = AL

    
    Monday, August 26, 2013 2:56 PM
  • i have tested this... but not works...

     Dim numerofactura = From contador In Me.DataWorkspace.FacturacionData.series
                                    Where contador.EMPRESA = "01" And contador.SERIE = "AL" And contador.TIPODOC = 2
                                    Select contador.CONTADOR
     
                ShowMessageBox(numerofactura.ToString)

    This is the error:

    Microsoft.LightSwitch.ClientGenerated.Implementation.QueryImplementation`1[System.Decimal]

    after declare numerofactura as string i get this:

    Detalles del error: No se puede convertir un objeto de tipo 'Microsoft.LightSwitch.ClientGenerated.Implementation.QueryImplementation`1[System.Decimal]' al tipo 'System.String'


    Monday, August 26, 2013 8:01 PM
  • I mind that the problem is WCF ?

    i have changed to retrieve a strinand i give same problem... 

     Dim numerofactura = From contador In Me.DataWorkspace.FacturacionData.series
                                    Where contador.EMPRESA = "01" And contador.SERIE = "AL" And contador.TIPODOC = 2
                                    Select contador.EMPRESA
         
                ShowMessageBox(numerofactura)

    Error al ejecutar el comando.
    Detalles del error: No se puede convertir un objeto de tipo 'Microsoft.LightSwitch.ClientGenerated.Implementation.QueryImplementation`1[System.String]' al tipo 'System.String'

    Monday, August 26, 2013 9:33 PM
  • Are you trying to execute this logic from code running on a SL client?  If so, the type of query you are executing is referred to as a projection query.  A Projection query is a query that selects a non-entity type - typically a subset of properties from an entity.  Projection queries are not supported on the SL client.  You must select entities.  In order to achieve the results you want, I would suggest trying the following.

    Dim result = From contador In Me.DataWorkspace.FacturacionData.series
        Where contador.EMPRESA = "01" And contador.SERIE = "AL" And contador.TIPODOC = 2
        Select contador
         
    ShowMessageBox(result.Single().EMPRESA)
    
    Monday, August 26, 2013 10:07 PM
  • thanks! works fine!!!


    Monday, August 26, 2013 10:37 PM
  • I have found in the database there is a field target ORDER, which requires a value.
    By default I have seen that the field has 10 spaces.
    I tried putting in the field that I do the INSERT "          ", but like I said the field is mandatory.

    If I put "        1" if it works ... but what I really need is to have a value of 10 spaces.

    As I can do?
    Monday, August 26, 2013 11:27 PM
  • this is the insert... (list of debug...)

     i need on PRESUP (10 Spaces....)

    USUARIO=IMSAT | EMPRESA=01 | NUMERO=123 | FECHA=27/08/2013 1:34:52 | CLIENTE=4300000008 | ENV_CLI=1 | PRESUP=       | PRONTO=0 | VENDEDOR=01 | RUTA=01 | ALMACEN=01 | IVA_INC=False | FACTURA=     aa   | FECHA_FAC=<null> | ASI=         aa          | FPAG=02 | IMPORTE=100 | OBSERVACIO=aaaa | BANC_CLI=0 | DIVISA=000 | CAMBIO=1 | IMPDIVISA=0 | FINAN=0 | VISTA=True | COSTE=0 | PESO=0 | LITROS=0 | OBRA=11 | TRASPASADO=False | RECEQUIV=False | TAG=False | OPERARIO=01 | LETRA=AL | FACTURABLE=True | COT_PUNT=0 | PUNTOS=0 | COMMS=False | SEND_FRA=False | CLIFINAL=  1       | KEYCOPY=     1       | IMPRESO=False | LIBRE_1=    1     | LIBRE_2=    1     | LIBRE_3=     1     | CERTIFIC=0 | STOCK_COEF=1 | TPCRETNOFI=0 | EDI=False | GASTOS=True | ENVIADO=0 | LIBRE_4=0 | FECHASTOCK=27/08/2013 1:34:52 | EXPORTAR=<null>)

    Monday, August 26, 2013 11:33 PM
  • Anyone can help me¿?
    Tuesday, August 27, 2013 2:32 PM
  • This is the Escenario:

    Validation Error: 0
        Message: El campo OBRA es obligatorio.
        Target: LightSwitchApplication.c_albvenItem(    4   )(Key: EMPRESA=01 | NUMERO=123 | LETRA=AL)
        Property: OBRA
        PropertyValue:     

    i send to property obra:

     nuevoalbaran.OBRA = "    "
    

    I need, to put this value...

    This is entire string;

        Added: LightSwitchApplication.c_albvenItem(    4   )(Key: EMPRESA=01 | NUMERO=123 | LETRA=AL)(Properties: PEDIDO=    4    | USUARIO=IMSAT | EMPRESA=01 | NUMERO=123 | FECHA=27/08/2013 16:49:04 | CLIENTE=4300000006 | ENV_CLI=1 | PRESUP=   q       | PRONTO=0 | VENDEDOR=01 | RUTA=01 | ALMACEN=01 | IVA_INC=False | FACTURA=     aa   | FECHA_FAC=<null> | ASI=         aa          | FPAG=02 | IMPORTE=100 | OBSERVACIO=aaaa | BANC_CLI=0 | DIVISA=000 | CAMBIO=1 | IMPDIVISA=0 | FINAN=0 | VISTA=True | COSTE=0 | PESO=0 | LITROS=0 | OBRA=     | TRASPASADO=False | RECEQUIV=False | TAG=False | OPERARIO=05 | LETRA=AL | FACTURABLE=True | COT_PUNT=0 | PUNTOS=0 | COMMS=False | SEND_FRA=False | CLIFINAL=  1       | KEYCOPY=     1       | IMPRESO=False | LIBRE_1=    1     | LIBRE_2=    1     | LIBRE_3=     1     | CERTIFIC=0 | STOCK_COEF=1 | TPCRETNOFI=0 | EDI=False | GASTOS=True | ENVIADO=0 | LIBRE_4=0 | FECHASTOCK=27/08/2013 16:49:04 | EXPORTAR=<null>)

    Tuesday, August 27, 2013 2:48 PM