Query for Alert

Hi,
Wondering if someone could please help me out with query required for Alert.
Alert to notify user of any Sales Order entry added for items belonging to Item group code "171".
The resulted Alert needs to give the alerted user the ability to drill down into listed orders.
I appreaciate any help given.
thks
Kelly

Hi,Guys
Generally, you can use the SP named by SBO_SP_TransactionNotification,
for example
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
ALTER  proc SBO_SP_TransactionNotification
@object_type nvarchar(25),                     -- SBO Object Type
@transaction_type nchar(1),               -- [A]dd, <u>pdate, [D]elete, [C]ancel, C[L]ose
@num_of_cols_in_key int,
@list_of_key_cols_tab_del nvarchar(255),
@list_of_cols_val_tab_del nvarchar(255)
AS
begin
-- Return values
declare @error  int                    -- Result (0 for no error)
declare @error_message nvarchar (200)           -- Error string to be displayed
select @error = 0
select @error_message = N'Ok'
--     ADD     YOUR     CODE     HERE
declare @bbb nvarchar(200)
declare @aaa int
if  @object_type='17'--sale order
begin
    if ((@transaction_type='A') or   ( @transaction_type='U'))
    begin
     select @aaa=count(itemcode) from rdr1 where docentry =@list_of_cols_val_tab_del and itemcode not  in (select itemcode from oitm where itmsgrpcod = '171')
      if @aaa>0
      begin
      set @error=1
      set @error_message='Item group should belong in  171'
      end
    end
end
select @error, @error_message
end
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
also you can use some approval procedures.
Please try it
Best regards
Eric Wang

Similar Messages

  • Query for Alert on production order to be released

    Dear all users and experts,
    I need a query for getting an alert on production orders to be released (from planned status to release status) by whether reading the release date of production orders created from 'order recommendation window' or by reading the due date of production order and substract the lead time(days) of the item from its due date or by any means you know best.
    Thanks and best regards,
    Farhan Sufi

    Hi Gordon and Joseph,
    Thanks to both of you for giving me queries.
    Gordon, I made 3 production orders for testing from MRP order recommendation window from which 2 production orders has release date of today 9th July, 2010 (due date 12th July monday) and the 3rd one has release date of after weekend i.e. 12th July 2010 (due date is 13th July). release dates are calculated by MRP acording to the items' lead time and due date.
    Gordon, when I applied your query It gave me msg 'no data was found as a result of this selection criteria' Can you explain what your query will give me in result?
    where as Joseph, when I applied your query on alert, it gave me all 3 production orders as an alert to be released. I was expecting it will give me alert for 2 production order for today as their release date in MRP is today(9th July, 2010) and the alert for 3rd production order should come on 12th July and not today.
    what I understood your query is displaying all production orders which have status 'planned' regardless of their release date.is it?
    Joseph can you edit this query in such a way that It should consider the release date (calculated from due date and lead time in MRP order recommendation window) and display only those production orders which should be released today and exclude those which have release date in future. so that I can get alert for only those production orders which should be released today.
    I hope good response from both of you
    Thanks and best regards,
    Farhan

  • Query for Alert - Document saved as Draft

    Hi,
    I have no idea how a query is written to activate the alert. My requirement is in 2005B PL 27. I have give an alert to a particular user when a GRPO is saved as Draft. Is that possible? If yes, what is the query that does the same?
    Regards
    Sudatt

    Sorry Object Code for GRPO is 20,It is corrected in query.
    SELECT T0.DocEntry,T0.DocDate,T0.CardName, T0.DocTotal FROM ODRF T0
    WHERE DateDiff(dd, T0.DocDate,GETDATE()) = 0 AND T0.ObjType = 20
    Edited by: Jeyakanthan A on May 26, 2009 12:41 PM

  • Creating a conditional query for alert

    Hope someone can help with this, I am trying get an SQL query to work in an alert that returns a sales quotation number based on UDF's in the record. The basic query is:
    SELECT     DocNum, CardCode, CardName
    FROM         OQUT
    WHERE     (U_PLApr = 'I') AND (CANCELED = 'N') AND (DocStatus = 'O')
    AND
    IF (U_CableCk = 'Y') AND (U_CAApr = 'C') AND
    IF (U_Electrical = 'Y') AND (U_ELApr = 'C') AND so on...
    In this example, if U_cableck = 'N' I want to ignore that part, and check U_Electricalck = 'Y' and U_elapr='C'.
    To put it more simply, if the first condition is Y, then check to see if the second is 'C'. If all cases are true, then return the data fields.
    There are about 8 conditions within the OQUT record like this. I could write a large number of selects with AND and OR statements to cover all possible combinations, but am looking for a better way.
    I have tried writing case statements into my query, but nothing is working.
    Any help is much appreciated

    Suda, tried the query this way:
    SELECT docnum, CardCode, Cardname from OQUT where  U_PLApr = 'I'  and canceled = 'N' and docstatus = 'O'  and ((U_cableck = 'Y') and (U_CAApr = 'C')) and ((U_electricalck='Y') and (U_ELApr='C'))
    If U_cableck <> Y, or U_electricalck <> Y, the query returns no results, when it should show results. Only when all the vales are Y and C does the query give results. Which is not always the case.
    The possible data here is:
    U_Cableck    U_CAApr     U_Electrical      U_ELApr        Should have Result
    Y                      C                   Y                     C             Yes
    Y                      I                     Y                     I               No
    Y                      C                   N                     I              Yes
    Y                      I                     N                     I               No
    N                      I                     Y                     C             Yes
    N                      I                     Y                     I               No
    N                      I                     N                     I               No
    Y and N represent Yes and No - whether or not the user needs to approve
    C and I represent Complete and Incomplete - the user changes incomplete to complete if they are Yes in the first UDF.
    Hope this helps it make sense, may not be possble to test the data this way. Thanks

  • Alert message(Query) for a Production order?

    Hi Experts,
    I want to get an alert message for the production order doucument based on the due date of it. The user must get the alert a  one day before the duedate of the document. How to write the Query for it? Urgent ,waiting for earliest reply.
    Regards ,
    Magesh.

    Create a Formatted Seach with the following Query
    SELECT T0.DocNum AS 'Document Number', T0.CreateDate AS 'Creation Date', T0.DueDate AS 'Due Date'
    FROM  [dbo].[OWOR] T0  WHERE DATEDIFF(Day,GetDate(),T0.DueDate) = 1
    Then, Create an Alert from Adminis..> Alerts Management and Give a Name, Click Open Saved Query, Select the query you saved, Tick the Int. check box against the user who gets the Alert.  Check Active. Select Frequency.
    Good luck
    Suda

  • SQL query for custom alert view

    I have created a custom alert view and scoped to show alerts related to group of servers.
    Alert view Criteria: Resolution State - New, Severity - Warning and Critical, Group - "Group 1"
    I am trying to query the Operations Manager database to show the alerts with same criteria using below query.
    select MonitoringObjectName, ResolutionState, Priority, Severity, TimeRaised, TimeAdded, TimeResolved, AlertStringName, AlertStringDescription from AlertView where ResolutionState = '0' AND (Severity = '2' or Severity = '1')
    AND
    MonitoringObjectId IN (select TargetObjectId from RelationshipGenericView
    where SourceObjectDisplayName = 'Group 1')
    in Console i see both warning and critical alerts where as in SQL query output i see only critical alerts.  Could you please correct if I am using wrong query. also please share your suggessions if i am completely wrong on this.
    Kind Regards,
    Bommi
    ~Bommi

    your query looks perfectly fine. Are you sure if the alerts you see in the console are of the 'Resolution State =0' (New). It might be the case where the alert have moved to a fidderent resolution state.
    Also, take a sample warming alert from console, query for the same in DB and check the Severity value. If it is '2'.
    Regards,
    Saravanan

  • Query Through Alerts Managments For Due AMount

    Dear All
    Hoew to create Query through Alerts Managments for due amount after completion of Due date of AR Invoice
    Edited by: tjoshi1982 on Aug 26, 2010 2:16 PM

    Dear tjoshi1982,
    May I ask you why you need this query?
    In SAP Business One there is the opportunity to use the Dunning Wizard. If the information regarding the dunning information for every customer are set, when the Dunning Wizard runs it will tell inform which customer is late and which document s/he has not paid yet.
    Please, let me know if this alternative is interesting for you and if not, please let me know why you need this query.
    Regards,
    Marcella Rivi
    SAP Business One Forums Team

  • Query for an ALERT to give items that haven't sold in 60 days

    To the Experts.
    Can someone help me with a query for an ALERT. I need items that haven't sold in the last 60 days?

    Try this query.
    select max(t1.docdate) as [Last Inv Date], t0.itemcode, t0.dscription
    from inv1 t0 inner join oinv t1 on t0.docentry = t1.docentry
    where t1.doctype = 'I'
    group by t0.itemcode, t0.dscription
    having max(t1.docdate) <= getdate() - 60
    order by t0.itemcode
    The value getdate() is today, so getdate() - 60 will move the filter date back 60 days.  This looks at A/R Invoices and only Items type documents.
    I hope this helps.
    Ross Unger - Third Wave Business Systems

  • Operations manager failed to run a wmi query for wmi events (0x800706ba)

    Hi everyone,
    I've been working on this issue for a while and I am still no closer to finding out what the problem is.  If anybody can offer any other advice or things to check, I'm all ears.
    I'm running SCOM 2012 R2 with UR2, and the Cluster Management Pack v6.0.7063.0
    My problem is on one particular batch of cluster servers where I am getting the following error.
    Name: Operations Manager failed to run a WMI query for WMI events
    Alert Description:
    Module was unable to enumerate the WMI data
    Error: 0x800706ba
    Details: The RPC server is unavailable
    Workflow name: Microsoft.Windows.Cluster.Node.StateMonitoring
    Instance Name: servername.domain.local
    Instance ID: {instance_id}
    Management group: SCOM_Management_Grp_Name
    I am getting this alert regardless of whether I run the Windows Cluster Action Account as Local System, or as a domain user with full local admin privileges on all the cluster nodes.
    When looking at the management pack and the workflow in particular (Microsoft.Windows.Cluster.Node.StateMonitoring), I can see that it's trying to access
    MSCluster_Node in the root\MSCLUSTER WMI namespace.
    This is the workflow for your information...
    <UnitMonitor> ID="Microsoft.Windows.Cluster.Node.StateMonitoring" Accessibility="Public" Enabled="onEssentialMonitoring" Target="ClusLibrary!Microsoft.Windows.Cluster.Node" ParentMonitorID="Health!System.Health.AvailabilityState" Remotable="true" Priority="Normal" TypeID="ClusLibrary!Microsoft.Windows.Cluster.CheckState" ConfirmDelivery="false">
    <Category>AvailabilityHealth</Category>
    <AlertSettings AlertMessage="Microsoft.Windows.Cluster.Node.StateMonitoring.AlertMessage">
    <AlertOnState>Warning</AlertOnState>
    <AutoResolve>true</AutoResolve>
    <AlertPriority>Normal</AlertPriority>
    <AlertSeverity>MatchMonitorHealth</AlertSeverity>
    <AlertParameters>
    <AlertParameter1>$Target/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</AlertParameter1>
    <AlertParameter2>$Target/Property[Type="ClusLibrary!Microsoft.Windows.Cluster.Node"]/ClusterName$</AlertParameter2>
    </AlertParameters>
    </AlertSettings>
    <OperationalStates>
    <OperationalState ID="Success" MonitorTypeStateID="Online" HealthState="Success" />
    <OperationalState ID="Warning" MonitorTypeStateID="Partial" HealthState="Warning" />
    <OperationalState ID="Error" MonitorTypeStateID="NotOnline" HealthState="Error" />
    </OperationalStates>
    <Configuration>
    <ClusterObjectName>$Target/Property[Type='ClusLibrary!Microsoft.Windows.Cluster.Node']/NodeName$</ClusterObjectName>
    <PollInterval>60</PollInterval>
    <ClusterObjectClass>MSCLUSTER_Node</ClusterObjectClass>
    <OnlineExpression>
    <SimpleExpression>
    <ValueExpression>
    <XPathQuery Type="String">Property[@Name='EventNewState']</XPathQuery>
    </ValueExpression>
    <Operator>Equal</Operator>
    <ValueExpression>
    <Value Type="String">0</Value>
    </ValueExpression>
    </SimpleExpression>
    </OnlineExpression>
    <OnlineExpressionOnDemand>
    <SimpleExpression>
    <ValueExpression>
    <XPathQuery Type="String">Property[@Name='State']</XPathQuery>
    </ValueExpression>
    <Operator>Equal</Operator>
    <ValueExpression>
    <Value Type="String">0</Value>
    </ValueExpression>
    </SimpleExpression>
    </OnlineExpressionOnDemand>
    <PartialExpression>
    <Or>
    <Expression>
    <SimpleExpression>
    <ValueExpression>
    <XPathQuery Type="String">Property[@Name='EventNewState']</XPathQuery>
    </ValueExpression>
    <Operator>Equal</Operator>
    <ValueExpression>
    <Value Type="String">2</Value>
    </ValueExpression>
    </SimpleExpression>
    </Expression>
    <Expression>
    <SimpleExpression>
    <ValueExpression>
    <XPathQuery Type="String">Property[@Name='EventNewState']</XPathQuery>
    </ValueExpression>
    <Operator>Equal</Operator>
    <ValueExpression>
    <Value Type="String">3</Value>
    </ValueExpression>
    </SimpleExpression>
    </Expression>
    </Or>
    </PartialExpression>
    <PartialExpressionOnDemand>
    <Or>
    <Expression>
    <SimpleExpression>
    <ValueExpression>
    <XPathQuery Type="String">Property[@Name='State']</XPathQuery>
    </ValueExpression>
    <Operator>Equal</Operator>
    <ValueExpression>
    <Value Type="String">2</Value>
    </ValueExpression>
    </SimpleExpression>
    </Expression>
    <Expression>
    <SimpleExpression>
    <ValueExpression>
    <XPathQuery Type="String">Property[@Name='State']</XPathQuery>
    </ValueExpression>
    <Operator>Equal</Operator>
    <ValueExpression>
    <Value Type="String">3</Value>
    </ValueExpression>
    </SimpleExpression>
    </Expression>
    </Or>
    </PartialExpressionOnDemand>
    <NotOnlineExpression>
    <And>
    <Expression>
    <SimpleExpression>
    <ValueExpression>
    <XPathQuery Type="String">Property[@Name='EventNewState']</XPathQuery>
    </ValueExpression>
    <Operator>NotEqual</Operator>
    <ValueExpression>
    <Value Type="String">0</Value>
    </ValueExpression>
    </SimpleExpression>
    </Expression>
    <Expression>
    <SimpleExpression>
    <ValueExpression>
    <XPathQuery Type="String">Property[@Name='EventNewState']</XPathQuery>
    </ValueExpression>
    <Operator>NotEqual</Operator>
    <ValueExpression>
    <Value Type="String">2</Value>
    </ValueExpression>
    </SimpleExpression>
    </Expression>
    <Expression>
    <SimpleExpression>
    <ValueExpression>
    <XPathQuery Type="String">Property[@Name='EventNewState']</XPathQuery>
    </ValueExpression>
    <Operator>NotEqual</Operator>
    <ValueExpression>
    <Value Type="String">3</Value>
    </ValueExpression>
    </SimpleExpression>
    </Expression>
    </And>
    </NotOnlineExpression>
    <NotOnlineExpressionOnDemand>
    <And>
    <Expression>
    <SimpleExpression>
    <ValueExpression>
    <XPathQuery Type="String">Property[@Name='State']</XPathQuery>
    </ValueExpression>
    <Operator>NotEqual</Operator>
    <ValueExpression>
    <Value Type="String">0</Value>
    </ValueExpression>
    </SimpleExpression>
    </Expression>
    <Expression>
    <SimpleExpression>
    <ValueExpression>
    <XPathQuery Type="String">Property[@Name='State']</XPathQuery>
    </ValueExpression>
    <Operator>NotEqual</Operator>
    <ValueExpression>
    <Value Type="String">2</Value>
    </ValueExpression>
    </SimpleExpression>
    </Expression>
    <Expression>
    <SimpleExpression>
    <ValueExpression>
    <XPathQuery Type="String">Property[@Name='State']</XPathQuery>
    </ValueExpression>
    <Operator>NotEqual</Operator>
    <ValueExpression>
    <Value Type="String">3</Value>
    </ValueExpression>
    </SimpleExpression>
    </Expression>
    </And>
    </NotOnlineExpressionOnDemand>
    <WMIFields>Name, State</WMIFields>
    </Configuration>
    </UnitMonitor>
    I can confirm that I am able to browse the MSCluster_Node class locally, as well as remotely using WMIEXPLORER and WBEMTEST,
    however it only works when I set the Authentication Level to
    Packet Privacy.  If I do not select Packet Privacy, a WMI event log error 5605 is logged on the remote servers application log that says...
    The root\mscluster namespace is marked with the RequiresEncryption flag.  Access to this namespace might be denied if the script or application does not have the appropriate authentication level.  Change the authentication level to Pkt_Privacy
    and run the script or application again.
    I can confirm that all firewalls are turned off, and there are no firewalls between the management servers and the agents in question.  AV exclusions have been done and appear to be in place.  The nodes are all Windows 2008 R2 with SP1.  As
    far as I can tell there is plenty of memory available on each of the nodes in question (50%+) of RAM is available. 
    If I manually run the "Discover the Windows Server 2008 R2 Cluster Components" task in the Cluster Service State section of the management pack in the Monitoring Pane in the console, on the nodes in question - the discovery runs successfully.
    Does anybody have any other ideas or suggestions I could try?
    Many thanks in advance,
    Noel.
    http://www.dreamension.net

    Hi,
    Common causes of RPC errors include:
    Errors resolving a DNS or NetBIOS name.
    The RPC service or related services may not be running.
    Problems with network connectivity.
    File and printer sharing is not enabled.
    For more information, please review the link below:
    Windows Server Troubleshooting: "The RPC server is unavailable"
    http://social.technet.microsoft.com/wiki/contents/articles/4494.windows-server-troubleshooting-the-rpc-server-is-unavailable.aspx#Identify
    Troubleshooting RPC Errors
    http://technet.microsoft.com/en-us/magazine/2007.07.howitworks.aspx
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Change Icon (Symbols) for Alert  in Analysis Item in BI 7 Web Templates

    I want to change the Icons (Symbols) displayed for alerts in the Analysis Web Item. I want to choose between arrows and stop lights. I can define this in the Table Interface in BW 3.5. In BI7 you must use the Analysis Web Item SYMBOL but it is not documented how to choose different symbols for different reports.

    Where do I choose the Icon Type? In the Query definition I can't see any option to select the Icon Type and in the WAD I can only see the options of Color, Symbol, Text and Symbol, Symbol and Text. This has no influence in the Icon Type or does it?
    I am getting Arrow icons in the output and I am trying to get Traffic light icons.
    Can you tell me where the Icon Type is available for selection?
    Thanks!

  • Query for price list

    Experts,
    Can you please tell me what will be the query for
    for all prices which are u201C0u201D empty  (products)
    Thanks a lot in advance

    Thanks a lot Rahul and Gordon
    I am trying like as per the need
    SELECT T0.ItemCode, T0.ItemName, T0.ItmsGrpCod, T2.ListNum, T2.ListName,
    Sum (T1.[Price]) FROM OITM T0 INNER JOIN ITM1 T1 ON T0.ItemCode = T1.ItemCode INNER
    JOIN OPLN T2 ON T1.PriceList = T2.ListNum GROUP BY  T0.[ItemCode] HAVING Sum (T1.[Price]) <=0
    But error comes like
    1). [Microsoft][SQL Native Client][SQL Server]Column 'OITM.ItemCode' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. 2). [Microsoft][SQL Native Client][SQL Server]Statement 'Received Alerts' (OAIB) (s) could not be prepared.
    Please Help

  • In perfdatasource querying for global snapshot failed with error 'the size limit for this '

    I received  scom alerts from two win 2k8 r2 servers , hosting exchange 2010 mailbox roles , the alerts came almost in same time from both servers ,
    can I ignore those alerts
    or can someone give a me a clue how can I troubleshoot those alert , please any help would be appreciated
    In PerfDataSource, querying for Global Snapshot failed with error 'The size limit for this '
    from Ops-mgmt logs 
    Log Name:      Operations Manager
    Source:        Health Service Modules
    Date:          
    Event ID:      10104
    Task Category: None
    Level:         Error
    Keywords:      Classic
    User:          N/A
    Computer:       server 1
    Description:
    In PerfDataSource, querying for Global Snapshot failed with error 'The size limit for this ' 
    One or more workflows were affected by this.  
    Workflow name: Microsoft.Windows.Server.2008.OperatingSystem.PercentMemoryUsed.Collection 
    Instance name: Microsoft Windows Server 2008 R2 Enterprise  
    Log Name:      Operations Manager
    Source:        Health Service Modules
    Date:          
    Event ID:      10104
    Task Category: None
    Level:         Error
    Keywords:      Classic
    User:          N/A
    Computer:       server 1
    Description:
    In PerfDataSource, querying for Global Snapshot failed with error 'The size limit for this ' 
    One or more workflows were affected by this.  
    Workflow name: Microsoft.Windows.Server.2008.LogicalDisk.PercentIdle.Collection 
    Instance name:  " edb file path "
    Log Name:      Operations Manager
    Source:        Health Service Modules
    Date:          
    Event ID:      10104
    Task Category: None
    Level:         Error
    Keywords:      Classic
    User:          N/A
    Computer:       server 2 
    Description:
    In PerfDataSource, querying for Global Snapshot failed with error 'The size limit for this ' 
    One or more workflows were affected by this.  
    Workflow name: Microsoft.Windows.Server.2008.NetworkAdapter.CurrentBandwidth.Collection 
    Log Name:      Operations Manager
    Source:        Health Service Modules
    Date:          
    Event ID:      10104
    Task Category: None
    Level:         Error
    Keywords:      Classic
    User:          N/A
    Computer:   server 2   
    Description:
    In PerfDataSource, querying for Global Snapshot failed with error 'The size limit for this ' 
    One or more workflows were affected by this.  
    Workflow name: Microsoft.ForefrontProtection.FPE.Server.PerformanceCollection.RealtimeScanMessageRate

    Hi Blake , 
    Thanks for your reply , I appreciate your help  ,
    I didn't put the alert from scom console because they were same as the events ( same source )
    Health Service Modules, I didn't want to spam
    more :-)
    also the two servers encountered the issue were mailbox servers and part of same DAG , it worth mention the alert were resolved
    by Exchange 2010 Correlation Engine service 
    http://blogs.technet.com/b/kevinholman/archive/2010/10/15/clustering-the-exchange-2010-correlation-engine-service.aspx
    http://support.microsoft.com/kb/2592561
    also the Opsmgmt logs are full of waring and error event like 2023 , 21402 ,  21403 , 1207 !!
    Log Name:      Operations Manager
    Source:        HealthService
    Date:          
    Event ID:      2023
    Task Category: Health Service
    Level:         Warning
    Keywords:      Classic
    User:          N/A
    Computer:      server 1
    Description:
    The health service has removed some items from the send queue for management group "SCOM" since it exceeded the maximum allowed size of 15 megabytes.
    1- alert from console >>
    In PerfDataSource, querying for Global Snapshot failed with error 'The size limit for this '
    One or more workflows were affected by this.
    Workflow name: Microsoft.Windows.Server.2008.OperatingSystem.PercentMemoryUsed.Collection
    Instance name: Microsoft Windows Server 2008 R2 Enterprise 
    EventSourceName: Health Service Modules

  • Results table difference when running query from Alert compared to Query Manager

    Hello,
    I have following query - Aim is to create alert to tell employee which customers to make visit to in next 4 weeks
    SELECT DISTINCT T1.CardName, T1.U_VisitDue, T1.U_VisitReason, T1.U_Priority, T1.U_Region as 'Area', T1.U_VNotes
    FROM dbo.OCRD T1
    WHERE DateDiff(d,T1.U_VisitDue, GETDATE()) <29
    Group BY T1.CardName, T1.U_VNotes, T1.U_VisitDue, T1.U_VisitReason, T1.U_Priority, T1.U_Region
    FOR BROWSE
    My problem is that when I run query through alert the field U_VNotes is displayed differently.
    Running the query from Query Manager the contents of this field appear in one field of the result table.
    Running the query via Alery the content of this field is split into several fields in results table according to 'new line' in field entry.
    This makes the results table from the Query less 'user-friendly' because if you want to sort the table by 'Date' column for example it makes a mess of the table because of the extra rows.
    I want results table to look like top version in picture below ... but i want to run from alert.
    Is this possible?
    How can I achieve it?
    Thanks for any assistance
    Regards, Karen

    Hi
    check this support note:1774628 The SQL SELECT DISTINCT Statement does not work in ALERTS
    Kind regards
    Agustín Marcos Cividanes

  • Query for due date

    Hi All,
    How to write a query for an alert to be generated 5 days before the document due date?
    thanks
    SV Reddy

    Hi Everybody for your valuable suggestions.
    When we execute this query in normal mode by going to user query menu, it returns some records that can be displayed on to the screen in a separate window.  When you attach this query to an Alert, how the Alert will trigger ?
    Is it when the query returns more than 1 record then the name of the Alert will display in the inbox of the user ? 
    OR
    Is it the result of the query displayed in the window?
    What will happen when this query returns 0 records ?  means is that true the alert wont be triggerred ?
    What is the base criteria that an alert take in to consideration when to send a popup to the specified users?
    Please reply
    Thanks

  • Query for Weekly Sales Report

    Dear Experts,
    I have developed the query for weekly sales report for the alert management to send out the report on every Monday as follow :
    SELECT T0.[CardCode], T0.[CardName], T0.[DocDate], T1.[ItemCode], T1.[Dscription], T1.[Quantity], T1.[LineTotal] FROM OINV T0  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode WHERE T0.[DocDate] between GetDate()-8 and GetDate()-1
    The weekly report received on every Monday through email is without column total for the "Line Total".
    Can the Sum of column "Line Total" to be included in the query ?
    Thus, the auto send report on every Monday by alert management will display the total.
    Thanks in advance for all your kind assistance.
    Regards,
    Clara

    Ok you want it at the bottom.......
    then you must must try this if you are running query generator....
    Else a good option is Crystal Report.
    You need to only add Group Sum.......
    SELECT T0.CardCode, T0.CardName, T0.DocDate, T1.ItemCode, T1.Dscription, T1.Quantity, T1.LineTotal FROM OINV T0 INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode WHERE T0.DocDate between GetDate()-8 and GetDate()-1
    Union All
    Select '','',Null, '','Total',Null, Sum(T1.LineTotal) FROM OINV T0 INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode WHERE T0.DocDate between GetDate()-8 and GetDate()-1
    Regards,
    Rahul

Maybe you are looking for