How to use ServerApplicationContext to do a remote query across multiple entities

Hello everybody,
My data model is like this:
"Case" -> one-to-many -> "Document"
Document has  the fields:
- "IsFinalised" (boolean)
-  File (large binary)
My business rule is: 'a Case is closed if all its documents are finalised'.
I am trying to do a query which returns whether a case is closed using ServerApplicationContext, but I don't want the query to load the large binaries for each Document into memory for given case.
Does this do the job?
int IsCaseClosed(int caseId)
using (var sac = ServerApplicationContext.CreateContext())
var relevantCase = sac.DataWorkspaces.ApplicationData.Cases.FirstOrDefault(c => c.Id = caseId);
return relevantCase.Documents.All(d => d.IsFinalised);

I think what you have is pretty close.  I would probably write it like this:
bool IsCaseClosed(int caseId)
bool isClosed = false;
if caseId > 0
using (var sac = ServerApplicationContext.Current ?? ServerApplicationContext.CreateContext())
isClosed = sac.DataWorkspace.ApplicationData.Cases_Single(caseId).Documents.All(d => d.IsFinalised);
return isClosed;

Similar Messages

  • How to use a fixed port for remote assistance in windows 8.1 behind a nat router freebox?

    Hello,
    Before to use remote assistance in windows 8.1, i need to configure my nat router freebox.
    But remote assistance ( msra.exe ) use a dynamique port and never the same.
    How to use a fixed port for remote assistance ini windows 8.1 ?
    And why i can't use easy connect ?
    i read that the router must implement the PNRP protocol. I think it's a propriatary microsoft's protocol unknow on my router.
    Thanks

    Hello,
    Very good. It's a big range ( 255 mini from 49152 )  for a single port but if it's the only one possibility...
    You are very helpfull ( i don't know if it's a good english but you make me very happy )
    Merci beaucoup

  • I can't figure out how to use coldfusion debugging on a remote server

    I can't figure out how to use coldfusion debugging on a CF
    installation on a remote server. Has anyone got experiance, I can't
    find any step by step instructions on how to do this using FLEX
    BUILDER 3

    Look at Chapter 13 of the iPad iOS4.3 User Guide

  • How to use rule and send the same email to multiple recipents

    Hi,
    My requirement is to send the workitem to the multiple recipents. one of my reiend suggest me to use the rule but i don't know how to use that .
    can any one of you suggest me how to use rule in workflow.
    Also i want to send the same email to multiple recipent .how can i do it by using the multiline variable...please advice me with example if possible..
    Note :- Is it necessary to saparate the email id with comma or i will add all the email next one another..
    Please suggest.
    Thanks in advance ,
    Anand

    Hi Anand,
    I would suggest you first follow the guidelines of the forum and a little searching. One of your questions has been asked just a few threads below.
    Regards,
    Martin

  • How to Use separate web template to a query, when default one is configured

    Hi,
       A default template is configured in SPRO. and all the queries display data using this template. Now I want to display a particular query result in a separed template that is customised to suit the need.
    how can I achieve it? When I customise template and attach query to it, it displays the result in this template, when executed from WAD. If I execute from Bex, The result is automatically displayed in the default template mensioned in SPRO.
    Please advise.

    If you want this template to be attached to this query alone - then you will have to have the same as a separate iView on portal.. when you execute from BEx the default template will get executed and by changing the default template all the queries will start using the default template... it is not possible for you to specify the template to be used when executing queries from BEx Query designer..

  • How to Use the Procedures in a Sql Query

    Hi Friends,
    Can anyone help me out whether can we use the procedure in the sql query..
    if yes help me out with an example
    my requirement is
    i have one sql query .. in which i need to use the procedure which returns multiple values... how can i overcome it,can anyone help me out for this..
    for your reference i am pasting the sql query
    SELECT paf.person_id
    FROM per_all_assignments_f paf START WITH paf.person_id = p_person_id
    AND paf.primary_flag = 'Y'
    AND paf.assignment_type IN('E', 'C')
    AND l_effective_date BETWEEN paf.effective_start_date
    AND paf.effective_end_date
    CONNECT BY PRIOR paf.supervisor_id = paf.person_id
    AND paf.primary_flag = 'Y'
    AND paf.assignment_type IN('E', 'C')
    AND l_effective_date BETWEEN paf.effective_start_date
    AND paf.effective_end_date
    and paf.person_id not in (>>>I HAVE TO USE THE PROCEDURE HERE<<<<);
    Thanks in advance

    We never saw your procedure, but maybe you could wrap it in a function
    SQL> create or replace procedure get_members(in_something IN number, out_members OUT sys_refcursor)
    is
    begin
      open out_members for
        'select level member_id from dual connect by level <= :num' using in_something;
    end get_members;
    Procedure created.
    SQL> create or replace type numbers as table of number;
    Type created.
    SQL> create or replace function members(in_something IN number)
    return numbers
    as
      member_cur sys_refcursor;
      members numbers;
    begin
      get_members(in_something, member_cur);
      fetch member_cur bulk collect into members;
      close member_cur;
      return members;
    end;
    Function created.
    SQL> select * from  table(members(4));
    COLUMN_VALUE
               1
               2
               3
               4
    4 rows selected.Variant on same using piplined function
    SQL> create or replace function members_piped(in_something IN number)
    return numbers pipelined
    as
      member_cur sys_refcursor;
      rec number;
    begin
      get_members(in_something, member_cur);
      loop
         fetch member_cur into rec;
         exit when member_cur%notfound;
         pipe row(rec);
      end loop;
      close member_cur;
      return;
    end;
    Function created.
    SQL> select * from  table(members_piped(4));
    COLUMN_VALUE
               1
               2
               3
               4
    4 rows selected.
    SQL> drop function members_piped;
    Function dropped.
    SQL> drop function members;
    Function dropped.
    SQL> drop type numbers;
    Type dropped.
    SQL> drop procedure get_members;
    Procedure droppedEdit:
    Sorry Blu, had not seen you already posted similar thing
    Edited by: Peter on Jan 27, 2011 5:38 AM

  • How to use bind variables in the following query

    CREATE OR REPLACE PROCEDURE MMDB.test IS
    sel_qtn VARCHAR2 (10);
    CURSOR PT_QUANTITY IS select * from mmdb.product_tree WHERE QUANTITY_CHECK ='E'
    AND run_id = 100
    a PT_QUANTITY%ROWTYPE;
    BEGIN
    FOR i IN PT_QUANTITY
    loop
    sel_qtn := i.quanttity-1;
    While sel_qtn>=1
    loop
    insert into mmdb.product_tree (BILLING_ACCOUNT_NO ,S_CODE) values (i.BILLING_ACCOUNT_NO ,i.S_CODE||'E');
    sel_qtn :=sel_qtn -1;
    End loop;
    commit;
    end;

    Don't duplicate threads: How to use bind variables in the following query

  • How to use ABAP Class to modify Web Query Result ??

    Hi all !
    We are using Web Templates to display our Query.
    What I would like to do ( and seems a really important issue for our users! ) is to have a "PAGE BREAK" everytime the value of a charateristics change in the report
    For Example :
    -Page 1-
    Division     Project
       A               1
                        2
                        3
    -Page 2-
    Division     Project
       B               1
                        2
                        3
    and so on....
    I read threads about using ABAP CLASS but no example what so ever...
    We are presently under BW 3.1 but are considering upgrading to 7.0 by the end of the year so if there is a solution to my problem on either version i'd like to know.
    If anyone has any information about how I can do this it would be most appreciated
    Thx
    JB.

    Hi Yong,
    Ravi is right, first check the blogs by Jocelyn, and if you still have specific questions you can ask them. I have used ABAP classes in workflow and I know Mike Pokraka tries to use classes exclusively.
    Regards,
    Martin

  • How to use MAX function in SSAS MDX Query

    I want to run this Query with MAX Condition on LAST_DATA_UPDATE Column .

    Hi Ashishsingh,
    According to your description, you want to know how to use MAX function in SQL Server Analysis Services MDX Query, right? In this case, please refer to the link below which describe the syntax and sample of MDX function.
    http://technet.microsoft.com/en-us/library/ms145601.aspx
    http://www.mdxpert.com/Functions/MDXFunction.aspx?f=64
    Hope this helps.
    Regards,
    Charlie Liao
    TechNet Community Support

  • How to use Field-symbol with dynamic select query

    Can anybody tell me, how to use field-symbols in the dynamic select query.

    FIELD-SYMBOLS <fs> { typing | STRUCTURE struc DEFAULT dobj }.
    1. ... typing
    2. ... STRUCTURE struc DEFAULT dobj
    The FIELD-SYMBOLS statement declares a field symbol <fs>. The name conventions apply to the name fs. The angle brackets of the field symbols indicate the difference to data objects and are obligatory. You can declare field symbols in any procedure and in the global declaration section of an ABAP program, but not in the declaration section of a class or an interface. You can use a field symbol in any operand position in which it is visible and which match the typing defined using typing.
    After its declaration, a field symbol is initial - that is, it does not reference a memory area. You have to assign a memory area to it (normally using the ASSIGN statement) before you can use it as an operand. Otherwise an exception will be triggered.
    eg.
    FIELD-SYMBOLS <fs> TYPE ANY.
    DATA: BEGIN OF line,
            string1(10) VALUE '0123456789',
            string2(10) VALUE 'abcdefghij',
          END OF line.
    WRITE / line-string1+5.
    ASSIGN line-string1+5(*) TO <fs>.
    WRITE / <fs>.
    output:
    56789
    56789
    reward if helpful
    anju

  • How to use Java code to implement Divide-and-Conquer multiplication???

    i think use Divide-and-Conquer multiplication algorithm to multiply 31415975 by 81882818. Because i have study data structure and algorithm for needs people helps to solve this problem!!! The answer is should equals the both number (31415975 * 81882818) multiplication! There are must pass the program to calculation the multiply with use divide-and-Conquer!
    How to use the program calculation the both number multiplication with divide-and-Conquer??? That is needs display the different number multiplication on the screen!!!

    This is what I think you meant to say
    yijun1988 wrote:
    I am considering using Divide-and-Conquer multiplication algorithm to multiply 31415975 by 81882818.
    Because i have study data structure and algorithm.
    I need help to solve this problem!
    The result should equal the product (multiplication) of the two numbers (31415975 * 81882818)
    The input must be passed as parameters to the program to calculate the product using Divide-and-Conquer!
    How to implement number multiplication with divide-and-Conquer?
    The steps of the algorithm need to be displayed on the screen!Which part of this are you having problems with?

  • How do I configure my contacts to be shared across multiple emails?

    How do I configure my iPhone6 contacts to be shared across multiple emails accounts?

    By interface I simply mean connected to the contacts.  I have two different gmail accounts, one that uses the apple mail app and the new one that launches from the gmail icon that I downloaded from the app store.  The new one doesn't recognize the contacts.

  • Using ATMI and tuxedo for distrubuted transactions across multiple DBs

              I am creating the framework for a given application that needs to ensure that data
              integrity is maintained spanning multiple databases not necessarily within an
              instance of weblogic. In other words, I need to basically have 2 phase commit
              "internet transactions" between a given coordinator and n participants without
              having any real knowlegde of their internal system.
              Originally I was thinking of using Weblogic but it appears that I may need to
              have all my particular data stores registered with my weblogic instance. This
              cannot be the case as I will not have access to that information for the other
              participating sytems.
              I next thought I would write my own TP...ouch. Everytime I get through another
              iteration I kept hitting the same issue of falling into an infinite loop trying
              to ensure that my coordinator and the set of participants were each able to perform
              the directed action.
              My next attempt has led me to the world of ATMI. Would ATMI be able to help me
              here. Granted I am using JAVA so I am assuming that I would have to use CORBA
              to make the calls but will ATMI enable me to truly manage and create distributed
              transactions across multiple databases. Please, any advice at all would be greatly
              appreciated.
              Thanks
              Chris
              

              I am creating the framework for a given application that needs to ensure that data
              integrity is maintained spanning multiple databases not necessarily within an
              instance of weblogic. In other words, I need to basically have 2 phase commit
              "internet transactions" between a given coordinator and n participants without
              having any real knowlegde of their internal system.
              Originally I was thinking of using Weblogic but it appears that I may need to
              have all my particular data stores registered with my weblogic instance. This
              cannot be the case as I will not have access to that information for the other
              participating sytems.
              I next thought I would write my own TP...ouch. Everytime I get through another
              iteration I kept hitting the same issue of falling into an infinite loop trying
              to ensure that my coordinator and the set of participants were each able to perform
              the directed action.
              My next attempt has led me to the world of ATMI. Would ATMI be able to help me
              here. Granted I am using JAVA so I am assuming that I would have to use CORBA
              to make the calls but will ATMI enable me to truly manage and create distributed
              transactions across multiple databases. Please, any advice at all would be greatly
              appreciated.
              Thanks
              Chris
              

  • How to use the *new* "per-user remote control"?

    Per the ARD discription page at:  http://itunes.apple.com/us/app/apple-remote-desktop/id409907375?mt=12
    It says under "Whats New in 3.5.1":
    "Per-user remote control
    You can remotely log in to a Mac with any user account on that computer and control it, without interrupting someone else who might be using the computer under a different login.
    How can I do this?  I can't seem to find the ability.  If I use ARD in it's "normal" mode, I am on the user's console at the same time they are.... I want to be "underneath" the console without affecting them.

    That capability is only available if your client systems are running Mac OS X 10.7 Lion. See:
    http://support.apple.com/kb/HT4715
    Regards.

  • How to use headphones as iPhone camera remote

    How do I use my headphones as iPhone camera remote.

    You simply plug your headphones into the device, then launch the camera app. Once you've got your shot set up, press the volume up or down buttons on your headphones.

Maybe you are looking for

  • Dynamic publishing of crystal report in portal.

    Hi All, My understanding of publishing Crystal Report in portal is using the URL iview, is my understanding correct. I have checked this in [Integration of BOE XI3.1 into the SAP Enterprise Portal 7.x|http://wiki.sdn.sap.com/wiki/display/BOBJ/Integra

  • Native Browser Support

    Hi I have successfully setup JavaHelp 2.0 to use the JDIC components and render the help through the Native Browser. However, I still have an issue with the links refereneced through the JavaHelp MAP file. Currently Internet Explorer is unable to ret

  • 5800 Xpress Music - When is coming to Singapore??

    N5800 Xpress Music was expected to release in Dec 08, but suddenly it has been delayed till Feb 09, why is this so?? Does the phone itself has many problems? Is the phone reliable? I came across with several Nokia models, it does give me some headach

  • Restrictions Passcode Failed Attempts

    I have heard that when I try to enter my restrictions passcode too many times(when it is incorrect of course) ilol eventually have to restore it to factory settings. Isn't this quite a silly idea? you'd think Apple would give the person in charge of

  • I can't open a file

    I had a Motion 5 file which I open and it won't show. It opens Motion 5, but it just says "Application Not Responding". However, once I open other files, I get the regular Motion 5 (If that makes sense.) So basically I saved this file while Motion cr