How can I evaluate the count of a query I'd like to execute with a map...

Hi. I have a problem with a query...
I hava created a query which a execute with a Map (I use the
executeWithMap(Map) method). The problem is that sometimes this query
returns a large resultset. So, I would like to execute an other query
(called query_count) before executing ther final query with the Map. If
the query_count returns a count < 200, I execute the final query. How can
I do ? There is an example I have read this in the documentation :
Query query = pm.newQuery (Magazine.class, "price < 5");
query.setResult ("count(this)");
Long count = (Long) query.execute ();
The problem in this example is that the query is not execute with a Map.
So my question is : "How can we do the evalute the count of a query we
would like to execute with a map ?". Thank you for any response.

Hi John,
You should be able to executeWithMap that query, too. Is that giving you
problems?
Note that there may be an easier solution. What do you do if there are more
than 200 results? If, e.g., you just get the first N, then one option is to
set the FetchBatchSize on the query to N (thus activating large result set
support), and then call size () on the resulting Collection. This will
issue a SELECT COUNT(*) to the database to determine the size automatically.
Thanks,
Greg
"John" <[email protected]> wrote in message
news:ctq9a8$4gr$[email protected]..
>
Hi. I have a problem with a query...
I hava created a query which a execute with a Map (I use the
executeWithMap(Map) method). The problem is that sometimes this query
returns a large resultset. So, I would like to execute an other query
(called query_count) before executing ther final query with the Map. If
the query_count returns a count < 200, I execute the final query. How can
I do ? There is an example I have read this in the documentation :
Query query = pm.newQuery (Magazine.class, "price < 5");
query.setResult ("count(this)");
Long count = (Long) query.execute ();
The problem in this example is that the query is not execute with a Map.
So my question is : "How can we do the evalute the count of a query we
would like to execute with a map ?". Thank you for any response.

Similar Messages

  • On the iPad Air, how can I get the lock screen to stay on longer like it was with an iPad 2?

    Since getting an iPad Air the lock screen does not stay on but for a few seconds after startup, how can I adjust the time of it? It used to stay on with my iPad2.Thanks

    I guess I never noticed that the swipe to open doesn't stay on very long.  But, I've not found this to be an issue as I usally swipe the moment I have the option to swipe.  It's been so long since I had a 2nd generation iPad that I honestly can't remember if it stayed on longer.  It's still not a problem for me.  There is no setting which will let you keep the swipe to open on longer, so it would reasonable for Apple to say there is nothing wrong with your iPad

  • How can I change the counter symbols for the slideshow templates in Muse?

    How can I change the counter symbols for the slideshow templates in Muse? Currently they are obviously normal text characters. So, how can I change them to filled circles, for example?

    Hi Aish,
    Thank you very much. This was very helpful. I am still new to Muse and try to find my way through all the features and possibilities. I like it very much so far.
    Does Muse support ‘liquid” design as well?
    Thank you !
    Best regards,
    Fred

  • How can I find the serial number for my stolen iPad that's associated with my apple ID ?

    How can I find the serial number for my stolen iPad that's associated with my apple ID ?

    If you registered it with Apple check your registered items at Your Support Profile for Registered Purchases. Also, see iOS- How to find the serial number, IMEI, MEID, CDN, and ICCID number.
    What To Do If Your iDevice Is Lost Or Stolen
    If you activated Find My Phone before it was lost or stolen, you can track it only if Wi-Fi is enabled on the device. What you cannot do is track your device using a serial number or other identifying number. You cannot expect Apple or anyone else to find your device for you. You cannot recover your loss unless you insure your device for such loss. It is not covered by your warranty.
    If your iPhone, iPod, iPod Touch, or iPad is lost or stolen what do you do? There are things you should have done in advance - before you lost it or it was stolen - and some things to do after the fact. Here are some suggestions:
    This link, Re: Help! I misplaced / lost my iPhone 5 today morning in delta Chelsea hotel downtown an I am not able to track it. Please help!, has some good advice regarding your options when your iDevice is lost or stolen.
      1. Reporting a lost or stolen Apple product
      2. Find my lost iPod Touch
      3. AT&T. Sprint, and Verizon can block stolen phones/tablets
      4. What-To-Do-When-Iphone-Is-Stolen
      5. What to do if your iOS device is lost or stolen
      6. 6 Ways to Track and Recover Your Lost/Stolen iPhone
      7. Find My iPhone
      8. Report Stolen iPad | Stolen Lost Found Online
    It pays to be proactive by following the advice on using Find My Phone before you lose your device:
      1. Find My iPhone
      2. Setup your iDevice on iCloud
      3. OS X Lion/Mountain Lion- About Find My Mac
      4. How To Set Up Free Find Your iPhone (Even on Unsupported Devices)

  • How can I disable the assistive touch programmatically ? This is like a bug. Though the Guided access is enabled a user can take screenshot of my application content. How can I solve this ? any idea ....

    How can I disable the assistive touch programmatically ? This is like a bug. Though the Guided access is enabled a user can take screenshot of my application content. How can I solve this ? any idea ....

    Question: Do you think the response from the support staff is correct? I mean, surely, I can't be the only CF user on a shared box whose other users need to modify the date and time within their applications. Even if they do it at the application level for their domain, surely it wouldn't affect mine, would it? That was what was implied by the support people, but I have a feeling they are way off, or covering for some goof-up on their end. I struggled like hell yesterday trying to get this to work and I did not get very far at all.
    I found an interesting tutorial here which does a comparison of time zones and, theoretically, this might do the trick. But if what the guy told me was nonsense then I won't bother with it. For the record, our calendar has been working fine for about a week now.

  • How can I export the results of a query?

    After executing a select statement I can see the results in a grid but how can I export the results (the data)?
    How can I export the results of a join of two or more tables?

    Right click in the results grid and select the Export menu option

  • How can I change the sound of push notifications on an iPhone 4 running with iOS5?

    How can I change the sound of push notifications?
    In settings > sounds there are various options but not the a possibility to change the general sound (!!!) of push notifications.
    Example: How can I change for instance the sound of the push notification of for example the New York Times notifications.
    Thanks for the help!
    Product: iPhone 4 running with iOS5

    What you see - what is available for this is what you get.

  • HT4759 How can I change the password on my stolen iPhone 5 which shares data with my ipad2

    How can I change the password on my stolen iphon5 which shares data with my ipad2

    If you had Find My iPhone activated on your iPhone, you can remotely wipe it, which you can do through iCloud on your computer.  If you did not have Find My iPhone active on your phone you're out of luck.
    You should immediately change all passwords for your Apple ID, email, any apps where you had a password, or any where you have credit cards tied to shopping.

  • How can I download the software for a second time without a backup but with  the serial number?

    Hi guys,
    stupidly my hardware got broken and I've missed to do a backup for the programs. May it's a stupid question but how can I download the Lightroom software for a second time? I've got the serial number for this, but can't find a link without buying it again....
    Thanks a lot for your help!!!!
    Cheers,
    Hannah

    Lightroom - all versions
    Windows
    http://www.adobe.com/support/downloads/product.jsp?product=113&platform=Windows
    Mac
    http://www.adobe.com/support/downloads/product.jsp?product=113&platform=Macintosh

  • How can i stop the time changing on my iphone when i sync it with my laptop?

    Each time I sync my iphone the tie jumps forward an hour.
    How can i stop this as it is causing me no end of trouble with alarms and work appointments. I have doubled checked the time and date is correct on my laptop and all is spot on.
    Any help appreciated.

    I had the similar problem last night and found a solution (although it takes more than a few clicks).  Highlight all the album tracks in itunes on the pc and right click "get info". Check the artwork box in this window.  I found that the now playing art was showing up in the itunes window, but on songs that were missing artwork showed nothing in the get info box.  When I replaced the artwork by using the artwork command, or manually adding it into the "get info" window.  It was annoying but my iphone updated every album.

  • How can i get the count vaule from GPIB?

    I want to get the count waule from GPIB ,but I find that the vaule I get from GPIB now is the trace vaule ,
    so I ask How can i get it.

    The count of what? What kind of instrument are you using?

  • How can I disarm the counter in a specified time?

    I am using 6602 counter. I use 2 counters to perform "Buffered Period Measurement ". I use internal time base (20MHz) as the SOURCE, and wire the signal to the Gate. The counters are triggered by a trigger signal.
    Now I just want to stop counting the signal in a specified time after the counters triggered. After that time, even the input signal is still running,the counting must be stopped. How can I implement this purpose? I don't know how to disarm the counter when the counter are still running, and how to exactly determinate the stop time.
    Thanks for any advise. I have attach my present routine here.
    Attachments:
    counters.vi ‏192 KB

    Just to expand a bit on Justin's answer to outline a few particulars.
    You mentioned using 2 counters to capture buffered periods so I'm assuming that you'll enable triggering to guarantee that they both have the same start time. Note that in this scheme, element #0 of your array of buffered periods will represent the time from the Trigger edge until the first Gate edge.
    Since your description made it sound acceptable to ignore pulse periods occurring later than the interval of interest, perhaps you can collect data for a little longer than necessary, then reset the counters and trim off the periods that came in "too late" using 'Array Subset.' A quick-and-dirty way is to loop over each array of periods, performing a cumulative sum until it exceeds the specified data collection time interval. That'll tell you the length of the subset you need to keep.
    The hard part is that after starting the measurement, you'll need to poll task attributes/properties to determine when the trigger has been received. Only after that's been determined would you start keeping track of approximate time in software.
    There are ways to do the timing in hardware if you get more of the 6602's counters involved. Here's one way:
    1. First configure your 2 counters for buffered period measurement. However, instead of using the internal timebase for a Source, use another counter's output as a Source. Under DAQmx, the internal routing details are handled for you; under traditional NI-DAQ, you'll need to make explicit routing via RTSI.
    Note that in this scheme, these 2 counters don't need to be triggered.
    2. Next, generate a finite-duration pulse train at 20 MHz (examples can be readily found under LabVIEW help or this website). This pulse train should last for your data collection time interval, and will act as the Source signal for your period measurements. It is important that the period-measuring counters are started before the finite pulse train.
    The finite pulse train uses 2 counters -- one to generate the output pulse train at 20 MHz and a "helper" that produces a single pulse whose duration equals your data collection interval time.
    If you need to synchronize to some external trigger signal, you can set the "helper" counter to be triggered, but there'll be one subtle catch. The first period measurement in your buffers will not include the time from the external trigger signal until the beginning of the single "helper" pulse, i.e., the "delay" time spec for the pulse. You can either make this very very short and ignore it, or make it any convenient duration and then add it to the first period measurements. Be careful though: the timebase for this "delay" time isn't necessarily the same as the timebase used to measure periods.
    There's quite a bit of complication there, so let me suggest an easier way that assumes no need to synchronize to an external trigger. (I'll use DAQmx terminology, since the traditional NI-DAQ would get complicated again with explicit RTSI signal routing.)
    A. As describe in #1 above, configure your period-measuring counters to use a 3rd counter's output as the timing source terminal.
    B. After starting your 2 period-measuring counters, start up the 3rd counter to generate a continuous 20 MHz pulse train.
    C. After the 3rd counter starts, call the 'Wait (ms)' function from the Time & Dialog palette. Wait for slightly longer than your desired collection time.
    D. Read all buffered periods from the counters. You may need to first query each to find out how many are waiting to be read.
    E. Reset all 3 counters.
    F. Do the cumulative sum work on the two buffered period arrays to determine where each should be truncated.
    Note that step "C" above will leave you stuck while data is being collected. A small variation would be to read a reference time ("Tick Count (ms)") right after starting your 20 MHz counter, then set up a loop that allows you to terminate early (logical OR of, say, "abort" button, data acq error cluster error, and time comparison). In that loop, you put a delay of maybe 50-200 msec using "Wait (ms)."
    "Wait (ms)" will output a tick count from which you subtract the reference time. When the difference exceeds your data collection time, you can exit the loop and continue with step D above.
    -Kevin P.

  • How can I calculate the count of each row and they are grouped in each mth?

    hi, I need help on a database question. How can I count the number of record grouped by the last 12 months? I don't know any way to iterate the month one by one so that it return a table like this:
    table_item
    id item
    1 A
    2 B
    3 C
    4 D
    table_record
    item date
    A 2006-01-01
    A 2006-01-01
    A 2006-01-01
    B 2006-02-01
    A 2006-03-01
    C 2006-04-01
    A 2006-04-01
    D 2006-05-01
    A 2006-05-01
    A 2006-12-01
    and I need a query to output following table:
    item_count_in_2006
    item 06-01 06-02 06-03 06-04 06-05 06-06 06-07 06-08 06-09 06-10 06-11 06-12
    A 3 1 1
    B 1
    C 1
    D 1
    I tried so many way to do it.. I think SQL can't even product a table like that. Please give me some comments.
    Thanks!

    select c1,
           count(decode(to_char(c2,'YYYYMM'),'200601',1)) "200601",
           count(decode(to_char(c2,'YYYYMM'),'200602',1)) "200602",
           count(decode(to_char(c2,'YYYYMM'),'200603',1)) "200603",
           count(decode(to_char(c2,'YYYYMM'),'200604',1)) "200604",
           count(decode(to_char(c2,'YYYYMM'),'200605',1)) "200605",
           count(decode(to_char(c2,'YYYYMM'),'200606',1)) "200606",
           count(decode(to_char(c2,'YYYYMM'),'200607',1)) "200607",
           count(decode(to_char(c2,'YYYYMM'),'200608',1)) "200608",
           count(decode(to_char(c2,'YYYYMM'),'200608',1)) "200609",
           count(decode(to_char(c2,'YYYYMM'),'200610',1)) "200610",
           count(decode(to_char(c2,'YYYYMM'),'200611',1)) "200611",
           count(decode(to_char(c2,'YYYYMM'),'200612',1)) "200612"
    from   tbl
    group by c1
    C     200601     200602     200603     200604     200605     200606     200607     200608     200609     200610 
    D          0          0          0          0          1          0          0          0          0          0          0          0
    A          3          0          1          1          1          0          0          0          0          0          0          1
    B          0          1          0          0          0          0          0          0          0          0          0          0
    C          0          0          0          1          0          0          0          0          0          0          0          0Nicolas.

  • How can I make the Counter move from inside text box to inside Footer?

    I am tweaking a page. At this point, I cannot move the Counter and the Email Me icon from the bottom of the text box to inside the footer like someone here said he does.
    Why do the Counter and the Email Me icon resist being moved?
    I am in Graphics mode. I never had this problem before.
    — Lorna in Southern California

    Lorna,
    I'm not sure why you can't move it down into the
    footer — by inside the text box, do you mean the page
    "content" or "body" section, or did you somehow get
    the icons into a text box? I know that you can
    "force" a text box into the footer (or header) by
    selecting it, then dragging it while holding the
    command (Apple) key down at the same time.
    Hope this helps.
    Bob
    Bob,
    When I say Text box maybe I am not using the right word. I am referring to that entire space on the page which is dedicated to receiving documents or images. If you have a lot of pictures or words, then that text box/space has to be lengthened to accomodate.
    I am saying that the two icons -- Counter and Email Me -- are sitting (or were sitting. It's morning now and honestly, I can't recall from last night!) at the very bottom of the text box/space.
    I made a Footer (55 pixels) specially to accomodate the Counter and Email icons. The problem, as stated, was/is that those icons would not budge from where they were sitting.
    — Lorna in Southern California

  • ¿HOW CAN I ACTIVATE THE COUNTER OF BYTES IN MY BLACKBERRY?

    Hello: I would like to know if it´s possible to activate the counter of bytes in my BB.
    Thanks a lot.

    Greetings, and welcome to the forums!
    You shouldn't need to activate anything. Simply go to Options > Memory, and you'll be able to see what's available on both the phone and memory-card.
    "Cats may taste like chicken, but they have more bones than rabbits."
    Blackberry 101
    Tips & Tricks
    Videos to learn from on youtube

Maybe you are looking for

  • Help me extend my network please!

    I have a home office where they physically can't install a cable outlet in here. So my cable modem and airport extreme are located in the bedroom all the way across the apartment. I want to include my printers on the wireless network, but I don't wan

  • TS1424 How To Enable My Apple ID it has been Disabled

    I need help accessing I have tried everything to enable my. Apple It has been disabled, I've tried resseting my pass, logging in and out also contacted iTunes via email and phone but they cant help me!! Help please

  • How to display html from the jar

    Hiiiiiiiii How I can to display html from jar file

  • [help]why data on table (master ) different  from materialized view(slave)?

    We have had Oracle RAC 2 Groups (master and slave). We have created materialized from slave to master. and I have created materialized view log on master . When slave group job is broken a long time(12 Hrs). We refreshed job and runned job id. But I

  • [svn:fx-trunk] 11824: Followup to the Group check-in.

    Revision: 11824 Revision: 11824 Author:   [email protected] Date:     2009-11-14 19:07:00 -0800 (Sat, 14 Nov 2009) Log Message: Followup to the Group check-in. QE notes: No Doc notes: No Bugs: No Reviewer: Me, I'll have Evtim or Ryan look at this on