Query en alarma

Buenas tardes,
se ha creado una alarma con el siguiente query pero no funciona, si se ejecuta la consulta aparte si devuelve resultados, pero la alarma no funciona que problema hay?
SELECT T0.DocNum as Factura,T0.DocDate as Fecha, T0.DocDueDate as Vence, T0.CardCode as Codigo, T0.CardName as Nombre, Sum(T1.LineTotal) as Subtotal, T0.DiscSum as Descuento, T0.VatSum as IVA, T0.WTSum as Retencion, T0.DocTotal as Total_Dcto, T0.PaidToDate as Pagado_Abonado, (T0.DocTotal- T0.PaidToDate) as Saldo_Total FROM OINV T0  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry WHERE CONVERT(VARCHAR(10),T0.DOCDATE,112)=CONVERT(VARCHAR(10),GETDATE(),112) and T0.DocStatus <> 'C' GROUP BY T0.DocNum,T0.DocDate, T0.DocDueDate, T0.CardCode, T0.CardName, T0.DiscSum, T0.VatSum , T0.WTSum, T0.DocTotal, T0.PaidToDate, (T0.DocTotal- T0.PaidToDate) ORDER BY T0.DocNum
Gracias por la ayuda,
Juan Camilo Arias J.

Estimado Juan
He visto tu query y me he fijado al lado de la expresión DOCSTATUS falta el signo igual, en la penúltima fila.
corrige ese problema y quizás soluciones tu problema.
Quedaría
T0.DocStatus = 'C' GROUP BY T0.DocNum,T0.DocDate, T0.DocDueDate, T0.CardCode, T0.CardName, T0.DiscSum, T0.VatSum , T0.WTSum, T0.DocTotal, T0.PaidToDate, (T0.DocTotal- T0.PaidToDate) ORDER BY T0.DocNum

Similar Messages

  • Failed to query Alarms & Events, alarms not logging

    Hi all,
    I've recently run in to an issue with the DSC Alarm & Event logging. I have a number of shared variable libraries all setup to log both data and alarms to Citadel. I've double checked that the library itself is configured for logging data and alarms, as well as all the variables. Using the DSM, I can see all of the active alarms in the system across all libraries, and can receive all alarm change events programmatically.
    For some reason, alarms for only one of the libraries are logging, and attempting to query the historical Alarms & Events through MAX throws an error roughly 14 out of 15 times (with no error code or indication of why it fails). I've also attempted to archive the Citadel database, with it failing with an unspecified error (presumably when archiving the alarms side of things, the data archive seemed to work).
    Can anyone offer some insight on how to resolve the problem, preferably without data loss? Further, how can I prevent the issue in future?
    Solved!
    Go to Solution.

    Thanks for your reply Joey.
    Libraries are being deployed using the DSC Deploy Libraries VI. The libraries also have data and alarm logging enabled programmatically. At the moment they're both being logged to the same database.
    I can't find the "Read Historical Trend.vi" through the DSC Examples. The article was written in 2005 and I'm using DSC 2012 SP1, so I don't know if things have changed since then. I can view the data through MAX without issue if that's any consolation.
    The mdf file is about 60MB, with the entire Citadel database at around 6GB.
    The Citadel service is definitely running. I've also attempted restarting it (and the PC itself) but the issue is still present.
    It's entirely possible there was a power failure, as this has been during a period of plant commissioning. When I can query the alarms through MAX there's a lot of data up to a certain point (end July), then it's very sporadic after that with only certain variable's alarms being logged.
    I attempted another database archive and this time it managed to get all the way through, though the archived database also has the same problems querying alarms and events. So at this point I suspect the mdf/mds files are corrupt in some way.
    Using the DSM, I've tried manually pointing the libraries to log alarms to a newly created database but this doesn't seem to work. No alarms or events are logged to the new database, and checking the library properties shows that the alarm database which I configured the library to log to had reverted to the original database. Am I missing something obvious here? Do I need to pre-create some traces in the new database before alarms and events will get logged there?
    Given I have managed to make a 'good' archive of the database, I'd like to try just deleting the alarms and events portion of the database and start clean. Is there a correct way to do this? I did find this article, but am unsure if this will work with a potentially corrupted database: http://digital.ni.com/public.nsf/allkb/9D3A81218264C68686256DE1005D794F If I stop all of the Citadel and SQLServer related services, can I simply delete the mdf/mds files?

  • Where do we exactly use tag query & alarm query??

    hi all,
         can anybody pls. clarify as to in what situations we actually use tag query, alarm query, & OLAP query & xml query???

    Hi Sushma,
                    OLAP query is used to use get the data from all the OLAP sources. But in xMII case it is preferably used to fetch data from SAP-BW. Using xml query we can get the data from xml files and also we can get the data from other query templates and business logi transactions. Using the following URL's
    for query template : <b>http://<server name>/Lighthammer/Illuminator?QueryTemplate=<Query Template path>&Param.1=..</b>
    for business logic transaction : <b>http://<server name>/Lighthammer/Runner?Transaction=<Transactin path>&InputParameter=<value>&OutputParameter=<OutputVariable defined in Transaction></b>.
                    Where as Alram queries are used in the case process systems as expalined by Ravi.
                     For tag queries you can find other threads already available. I think you want exact difference between the purpose of tag query and alarm query usage.
                     The alarm queries are used to store the events and actions related to the process systems, where as the tag queries store the process values with respect to time.
    Thanks,
    Rajesh.
    PS : Please award points if answer is useful.

  • DB API for automatically recovering message stuck in undelivered state

    Hi,
    Can someone point me to any DB APIs that can be used to automatically recover messages in undelivered state (orabpel.invoke_message, state=0)
    We have implemented a DB query to alarm if there are undelivered messages, want to take it to next level by triggering automatic recovery of such messages.
    Any help is appreciated.
    Thanks, Gopal

    I'm seeing this behavior too.
    MBP Retina from Mid 2012
    3/8/14 3:36:38.846 PM loginwindow[69]: DPRemoteDesktopPicture: error getting desktop picture for display 0x4280382, error = no desktop picture for display 0x4280382 and spid=3

  • Belegkette: Bestellung nach Ausgangsvorausrechnung

    Hallo,
    obwohl einige Dinge in SBO ganz gut gelöst sind - dieser Satz lässt mich unweigerlich schmunzeln - stößt man im Alltag doch immer wieder auf Vorgänge, die sich mit Bordmitteln nicht oder nur schlecht abbilden lassen. So z.B. dieser Fall:
    Kunde bestellt (Kundenauftrag) und zahlt per Vorkasse (Ausgangsvorausrechnung). Die Rechnung wird bezahlt und damit soll der Bestellvorgang (Kundenauftrag -> Logistik -> Bestellung) angestoßen werden, um die Verkaufsseite mit der Einkaufsseite zu verbinden. Da die Vorausrechnung die Belegzeilen des Auftrags geschlossen hat, ist dies nicht mehr möglich.
    Hat hier jemand eine Lösung? Natürlich könnte man die Bestellung vorab als geparkten Beleg anlegen und erst dann eine Vorausrechnung hinzufügen, weil SBO nun mal so funktioniert,aber es ist ärgerlich, dass Software im Jahr 2009 ...aber ich schweife ab. Das musste einfach mal raus.
    Viele Grüße
    Manuel
    SBO 2005A PL 43, Umstieg auf 2007A steht bevor
    Edited by: Rui Pereira on Mar 2, 2009 4:22 PM

    Hallo Manuel,
    in der Tat wirft dies ein Problem auf. Es ist wirklich mieserabel umgesetzt. In unserem Unternehmen haben wir daran auch herumprobiert. Geparkte Belege sind schön und gut, wenn man jedoch wie wir eine hohe Lagerumschlagsquote hat, ist man gezwungen ein Beleg zu erstellen, der auch eine Reservierung der Ware ermöglicht. Dies ist mit geparkten Belegen nicht machbar.
    Die Ausgangsvorausrechnungen waren zudem bei uns auch keine praktikable Lösung, da wir den Pick&Pack Manager missbrauchen, um einen weiteren Lagerbeleg zu erstellen.
    Kurzum, es gibt kein vernünftige Lösung in Business One. Wir behelfen uns zur Zeit damit, dass wir bei Vorkassen einen normalen Auftrag erstellen, der ein Lieferdatum jenseits der nächsten Jahre hat. Verbucht die Buchhaltung nun einen Zahlungseingang für eine Vorkasse, ändert Sie das Lieferdatum im Auftrag gleichzeitig mit auf Tagesdatum ab.
    Mit dieser Lösung stellen wir sicher, dass die Ware reserviert wird und der Auftrag korrekt in der Kommissionierung landet. Weiterhin habe ich ein Query mit Alarm eingerichtet, das Vorkassen anzeigt, welche länger als 3 Wochen unbezahlt im System stecken.
    Grüße Steffen

  • Alarm & Event Query To Spreadsheet File VI doesn't work correctly (DSC 7.1)

    I am using the Alarm & Event Query To Spreadsheet File VI to write alarms/events to an Excel spreadsheet. However there are two things it does wrong:
    1. Global variables in the header are not correctly inserted. I am using the header "{creationDate}{delimiter}{creationTime}" but none of the variables are translated to their actual values. The same header in Write Traces To Spreadsheet VI works correctly, so I assume it is only the Alarm & Event Query To Spreadsheet File VI that isn't working.
    2. My display format is set to display the date of the alarms but it never appears. Set time/ACK time, etc all appear, just not the date.
    Can anyone explain what might be wrong?

    Hi AndrewWilliams,
    I have been looking into this problem for you and I can't quite figure out exactly what it is you are trying to do. Could you possibly send me your VI's (for the Alarm & Event Query To Spreadsheet File VI and for the Write Traces To Spreadsheet VI) so I can get a better idea of it.
    Have you looked at the Export Alarms to File VI in the LabVIEW examples that are installed with the DSC module. This is a very good VI and it might help you to see any faults in your code.
    Hope this helps, I look forward to speaking to you soon.
    Best regards,
    Peter H.
    Applications Engineer.
    National Instruments.

  • Alarm & Event Query To Spreadsheet.vi

    dear all,
     i m using  "Alarm & Event Query To Spreadsheet.vi" for alarm transfer using following inputs
    1. Filter
    2.Display Format
    3. Output file path(C:\Program Files\National Instruments\LabVIEW 7.1\*.ALR)
    and Database URL it will take by default i.e current tagfile.scf
    on running this i get following error
    "HIST_AlarmsToSpreadsheet.vi, Citadel:  (Hex 0x8ABC1008) Read alarm failed because of connection or query failure."
    if i give the database URL manually in the following way
    \\computer name\Labview
    then i get the following error out
    "HIST_AlarmsToSpreadsheet.vi, IAK_SHARED:  (Hex 0x8ABC700A) Not found."
    so pls solve my problem as early as possible for u
     thanks and regards,
    dhanwanti

    Hi dhanwanti,
    There could be a couple possibilities here -- one is that the database you are trying to reference has become disconnected -- Make sure you can see historical data in MAX.  If needed, reconnect your database or create a new one and change this in the .scf file in the Tag Configuration Editor.
    Another possibility is that some of the parameters you have set in the filtering could be incorrect such as start and stop time.  I would suggest creating a simple test VI to make sure you can get the Alarm & Event Query To Spreadsheet.vi working, and then double check how it integrates into your project.   You may also want to take a look at the example that ships with the DSC Module for this VI, found in the Example Finder under Toolkits and Modules » Datalogging and Supervisory Control » Alarms and Events » Export Alarms to File.VI.
    Doug M
    Applications Engineer
    National Instruments
    For those unfamiliar with NBC's The Office, my icon is NOT a picture of me

  • Dsc, alarm query time out

    Hello,
    I'm using LabVIEW 2009 SP1 with DSC-Module. Today I had trouble using the "Alarm&Event Qurey.vi" to read data from the citadel database. The Query worked well for days and delivered the data quickly. Well today it didn't, instead it delivered a time out and it didn't help to set the time out value parameter to higher values (normally I use the default value, 30s). It did not help to restart my application, nor LabVIEW, nor Windows (XP, by the way). It simply stopped working.
    Then I tried my luck using the MAX and its Historical Data Viewer to retrieve the logged alarms and, unexpected, this worked! And after that, like there was magic in the air, the "Alarm&Event Query.vi" worked also again!
    So, this doesn't feel very reliable. I do not interact with the citadel database using other ways than the Query vi and the Library-/SharedVariable-Settings (writing to the data base is managed by the shared variable engine).
    Did someone experience the same problem and can I prevent this behavior somehow?
    Thanks in advance,
    Thomas

    Hello Thomas,
    Unfortunately it seems that this behavior is not reproducible.
    Has the error occurred again since your last post?
    I checked our internal database and I was not able to find any hints, that this is a common issue.
    Could you please post the important section of your code, if the error appears again?
    So we can dive a little bit more into detail.
    Regards
    Ulrich
    AE NI-CER  

  • Alarm and Event Query Very Slow

    Group,
    I am using the DSC Alarm and Event Query vi to pull data from the SQL database (not the Citadel).  I have a filter set up that specifies the "Alarm Area" and the start and stop dates with maximun results set to 22.  These dates are set to only pull the last 24 hrs.  This vi will return around 10 to 20 entries out of perhaps 80-90 total events in the last 24 hours in the database.   This database is ~2M in size.   I have to set the timeout to almost 10 min for this vi to not produce a timeout error.  The results returned are correct but it just seems that the time to run this vi is excessive.  It is quering a database on the same system that the quering vi is running on.  Should I expect better preformance?
    Thanks
    Todd

    Verne,
    I have boiled down the code to this attachment.  This query took almost 7 min to return 22 results from a database size that is listed as 2.09877E+6.  I have also tried the Alarms and Event Query to spreadsheet vi also and it takes the same amount of time.  I am wondering if I place the Alarms and Events into the same (Citidel) database that the traces are going if it would be much faster.  I seem to get trace data back very fast.  If I recall correctly I seperated the alarms from the trace because I was having some sort of problem accessing the alarm data in the combined database...but that was several labVIEW versions ago.  Anyone else having this problem?
    Thanks
    Todd
    Attachments:
    Generate Alarm Log General Test.vi ‏19 KB

  • Query ALARM not working

    Hi everyone
    I've created a query and set it as an alarm for specific users
    it is active and it has not being poping up the message on the Messages7alert Overview form of their sessions
    I was wondering if there is any limitation for the messages Service
    or maybe my query is too long:
    SELECT DISTINCT
           sc.DocDate,
           SC.Sol SC,
           sC.STATUS_SC,
           OC.OC,
           STATUS_OC,
           oc.canceled,
           (SELECT Y1.User_code
              FROM OUSR Y1
             WHERE Y1.INTERNAL_K = oc.Usersign)
              USUARIO
      FROM    (SELECT T0.DocEntry,
                      T0.DOCSTATUS STATUS_OC,
                      T0.Canceled,
                      T0.Cardcode,
                      T0.[CardName],
                      T0.[DocNum] OC,
                      cast (T0.[U_NROEM1] AS VARCHAR (10)) SC,
                      T1.[ItemCode] Art,
                      t0.Usersign
                 FROM    OPOR T0
                      INNER JOIN
                         POR1 T1
                      ON T0.DocEntry = T1.DocEntry
                WHERE substring (cast (T0.[DocNum] AS VARCHAR (10)), 5, 1) LIKE '2'
                                  group by T0.DocEntry,
                      T0.DOCSTATUS ,
                      T0.Canceled,
                      T0.Cardcode,
                      T0.[CardName],
                      T0.[DocNum] ,
                      cast (T0.[U_NROEM1] AS VARCHAR (10)),
                      T1.[ItemCode],
                      t0.Usersign ) OC
           FULL OUTER JOIN
              (SELECT T0.DocEntry,
                      T0.DocDate,
                      T0.DOCSTATUS STATUS_SC,
                      T0.Cardcode,
                      T0.[CardName],
                      cast (T0.[DocNum] AS VARCHAR (10)) SC,
                      T0.[DocNum] Sol,
                      T1.LineNum,
                      t0.Usersign
                 FROM    OPOR T0
                      INNER JOIN
                         POR1 T1
                      ON T0.DocEntry = T1.DocEntry
                WHERE substring (cast (T0.[DocNum] AS VARCHAR (10)), 5, 1) LIKE '1'
                             group by T0.DocEntry,
                      T0.DocDate,
                      T0.DOCSTATUS ,
                      T0.Cardcode,
                      T0.[CardName],
                      cast (T0.[DocNum] AS VARCHAR (10)) ,
                      T0.[DocNum],
                      T1.LineNum,
                      t0.Usersign) SC
           ON OC.SC = SC.SC
    WHERE sC.STATUS_SC LIKE 'O' AND OC.STATUS_OC <> ''
    hope you'll be able to help me
    Best regads,

    Hi,
    You are right.  There are many restrictions to alert query.  Your query is way complicated than alert function can handle.
    Thanks,
    Gordon

  • [Bug?] DSC - Clusters Different between 'Read Alarm.vi' and 'Alarm and Event Query.vi" but Contain 'Same' Data

    Howdy!
    Why are the clusters different coming out of the Read Alarm.vi and the Alarm and Event Query.vi when they have the exact same data?
    The only difference is the order of two last elements.
    I am leaning towards bug on this one, unless these clusters need to be distinct for some reason?
    Certified LabVIEW Architect * LabVIEW Champion

    Thanks for posting Ravens Fan
    I re-jiggered my API to reverse my datatypes then applied changes to my application code.
    It wasn't that painful to update. 
    My current understanding is that this bug affects one VI, so I decided it was easier to wrap that VI with the bugfix.
    Attached is my implementation if anyone wants it too.
    Cheers
    -JG
    [LV 2009]
    Certified LabVIEW Architect * LabVIEW Champion
    Attachments:
    Alarm & Event Query_bugfix.vi ‏30 KB
    Convert Alarm And Event Query Cluster.vi ‏21 KB

  • Can't send query-alarms via e-mail in 8.8 PL15

    Hi all,
    I have 8.8 PL15.  Made an alarm based on a query and am trying to send it via e-mail.  The SBO Mailer is properly configured, but the alarm is not going out.  The event viewer on the server shows:
    MessageEntity::MarkOneRecordError::Query SQL AOB1 failed -2028
    Note # 1440854 says that it's a product error and will be fixed in a later patch.  When PL12 was released, the correction was included, as note # 1464641 states; but I already have PL15 and the error still persists.
    Any ideas on how this can be solved??
    Thanks for any help or advise,
    Best regards,

    Hi Emilio,
    I have the same problem in pl17. Did you solve the problem?
    Best regards,
    Jan-willem Bruijsten

  • In the Alarm & Event Query VI how to show the alarm data

    In the Alarm & Event Query VI how to show the alarm data in the front pannel using the table or multicolumn listbox .thank you very much!!!

    Hi,
    Most likely there is something wrong with your specific database or your LabVIEW DSC installation. I just used the Alarm & Event Query.vi in my machine and it seems to work fine, I can see all the alarms as well as events containned in the database.
    You may considerer generate another database (change the logging directory) and see if the behavior goes away. Also, make sure you have alarms and events on that database.
    I could run the Alarm & Query.vi by just openning its front panel and placing the correct database in the appropriated control.

  • Alarma o query para costos

    Alguien ha hecho, visto o necesitado alguna alarma para cuando el costo de un articulo sube mas de un 10-15% ??
    Actualmente se tienen algunos detalles de errores humanos al capturar los costos de importacion y se quiere poner una alarma para saber cuando aumente un 10-15% el costo de un articulo, ya sea alarma o autorizacion y asi detectar estos movimientos.
    Alguien ha hecho algo de eso o visto ?
    Siento que debe ser un query en donde compare el ultimo costo de ese articulo con el nuevo sin embargo no se por donde empezar, alguien que me diera un norte?
    O alguien ha hecho algo similar?
    Edited by: Rui Pereira on Jun 24, 2008 6:51 PM

    Carlos,
    Alguna vez lo pense en implementar, casi como desafio mental y me encontré con el sgte problema a resolver:
    -. El costo de un item no va quedando de manera historica, es decir, si quieres saber el costo de un item a un momento X del tiempo pasado, significa que tienes que analizar las transacciones desde el dia CERO hasta ese momento.
    ¿cómo intentaría hacerlo?
    1. como un store procedure ON-demand, es decir, cuando alguien lo necesite lo ejecuta.
    2. ó ese store procedure como una alerta a ejecutarse 1 vez al dia o 2 veces al dia como máximo. Esto debido a que no es poco análisis y puedes cargar bastante el server si es mucha historia.
    3. El store procedure lo haria analizando la tabla OINM, pues alli esta la historia de movimientos item a item, bodega a bodega.
    4. Armaría una tabla temporal donde guardaria el costo del item por transaccion de la OINM, por FECHA; ITEM Y BODEGA.
    5. El dato del porcentaje lo dejaria como parametro en alguna USER TABLE.
    6. en función de la tabla temporal (tablas SQL Server #[nombre tabla]) y con el parametro, analizaría el valor del costo del registro X comparado con el registro X+1 para asi ir guardando un campo en la misma tabla de usuario que guarde la variación entre el costo anterior y el siguiente.
    7. Finalmente el reporte debe mostrar aquellos registros cuya variación sea más alta y en función del porcentaje ingresado.
    Esto fue lo que alguna vez pensé en hacer, pero que no logré resolver por falta de tiempo, pero sería una idea de por donde empezar.
    Debes tener cuidado con:
    -. lo que te decia al comienzo el mayor problema es contra que comparas el costo actual, pues una vez que una nueva transacción es ingresada a B1, el costo anterior es actualizado.
    -. debes validar los costos que con las querys obtengas, con los costos que B1 muestra en los reportes para asi estar seguros que tienes bien los calculos, después que entra cualquier transacción de inventario.
    Si lo logras hacer, no olvides publicarlo en el foro, pues sería una herramienta bastante util.
    saludos

  • Run a query on linked tables to create a new datasource

    Using Crystal XI
    I have a report that draws from two data sources.  They can't be joined at the server side, but they are linked in Crystal Database Expert. 
    I can't figure out if Crystal gives me a way to write an SQL Query to run an aggregate function referencing both tables.  The results of this query would be the datasource for a graph in the report.  I'm wondering if Crystal gives me a way, maybe through subreports, to write the query I need.
    More concretely:
    And I want to include in my datasource alarmId, Hour and the Maximum amount of calls received in any one hour for any one station (this maximum is to provide scale for a graph)
    In one table nameed AlarmStartTimes I have data like
    Alarms
    AlarmID  Hour    Recipient
    Alarm1       8       Joe
    Alarm23  10      Mark
    Alarm60  7      Joe
    Alarm95  8      Linda
    In another I have data like
    EELocation
    Recipient   Location
    Joe         Station1
    Mark         Station2
    Linda          Station1
    So if I could just join my talbes at the server side I'd use a query like:
    select *, max(select count(AlarmID) from Alarms, EELocation from Alarms Join EELocationo on Alarms.Recipient=EELocation.Recipient group by Hour, Location) AS  from Alarms
    Anyway, that's probably got a syntax error or 4 in it, but you get the idea.
    I can't group on the database side.  Since Crystal is able to link the two tables and successfully group them out by Location, it seems like there should be some way for me to run a query against the tables reflecting that existing link, but I can't see how to do it.
    The reason I can't link on database side is that the data is in two databases, and it's not known what the location of the databases is at report-writing time.  The location of the databases gets set via the Crystal API when the report is launched from an application.

    Since you have 2 datasource in the report you are limited on what you can use in crystal, such as crystal will not allow you to use sql expressions.

Maybe you are looking for

  • " " showing in browser but not in Dreamweaver

    Hi All, I'm pretty confused... I'm working on a website and on 2 different pages so far, I get a random arrow ">" showing on my page. I highlight it, right click, view selection source, and find ">". I open the page in dreamweaver, go to where this i

  • HT204053 How to manage two iPhones under one Apple ID?

    Me and my mom need help. We are using the same Apple ID and our contacts have now been jumbled up because she has just now downloaded to iOS 7.3 Now i have still not updated to iOS 7.3. but i do have iOS 7.1 Could this be a problem and how do we fix

  • OSX preview not showing acrobat-created table of contents

    I built a nice pdf bookmark tree/table of contents in Acrobat Pro. This has worked fine in the past. However oddly on this occasion while the table of contents looks fine in Acrobat, it does not show up in Preview. It's a 90 page doc assembled from M

  • Help With Pen in Photoshop?

    I just started using photoshop, but whenever I start to draw with my tablet or put down the pen on the canvas a little window pops up with all the brushes and settings as if I right clicked with my mouse. I've tried changing this with my pen settings

  • Ports Required for SCCM Distribution point

    Hi All, Can anybody tell me the ports required for distribution point. as in I have a site server with distribution point in HO, i want to have a distribution point server on a remote site. i went through the microsoft document which says u require p