Pretrigger samples with keyboard trigger?

Hi,
I am very new to Labview, so this may not be a difficult problem but I can't find the solution. I have built a vi to record sound using the NI USB-6251, but I would like to obtain a certain number of samples prior to a trigger. I see in the DAQmx Reference Trigger VI that there is an option for pretrigger samples, but the only way to trigger this VI is via a signal into one of the channels. This does not work for us because we wish to record all 8 channels at the maximum sampling rate. I was wondering if there is an option for some kind of manual trigger (such as a key or mouse click) to obtain pretrigger samples?
Thanks,
Hannah

Hi,
This is the general method I would suggest:
You could use an Event Structure to read a mouse click or keyboard button press, which in turn, when the event is triggered, would then set a digital output (for example) on your 6251 high, which would be wired into the trigger input for the 6251. This would then start the triggered acquisition. If you have any other questions regarding this I'll be happy to answer them.
Regards,
Dan - NIUK

Similar Messages

  • High speed sampling with analog trigger

    I am a new user of DAQ card and I need to sample the analog signal with a high speed.
    I will use a sinusoidal-like wave to trigger the sampling and set a voltage around the peak of trigger wave with rising slope. When the voltage arrived, I only sample one point from CH0 or CH1. The frequency of the trigger wave is about 5MHz and I heard the LabView only works at KHz level. Is it possible to use LABView to realize my application?
    If it's possible, would you mind telling me how to realize? Or if it's not possible, would you mind telling me what to do? My DAQ card is PXI-5112.
    Thank you very much!!!

    Hello amo71993,
    I guess in this case the solution is creating the little app programatically, save it as a VI and the use it as a function (subVI). Nevertheless I will be researching to see if there is another option and I will post it here.
    Regards.
     

  • Playing samples with keyboard

    Hi,
    I am new to GB and I am in the exploration phase. Really cool program. I haven't used a mixing/composing program before.
    I have a 0.5 seconds sound that I would like to use as an instrument in GB. (not as a loop). I would like to know if I can use the built in musical keyboard and play different notes with that sound as if it was an instrument.
    I noticed there is a AU sound file setting ( I am not in front of GB right now and I don't remember the exact name of it), which I thought it would let me do that, but no.
    Any ideas?
    Thank you.

    http://thehangtime.com/gb/gbfaq2.html#installsoundfonts
    http://thehangtime.com/gb/gbfaq2.html#usesoundfonts

  • Digital Triggering With Pretrigger Samples

    I am unable to trigger the PCI-6115 using the Digital Trigger A when the number of Pretrigger samples is greater then 0. Everytime I run the VI the acquisition times out. When I set the number of Pretrigger samples equal to 0 the VI works fine. I need to acquire pretrigger samples. What do I need to do to get the card to trigger properly?

    EZimney,
    Are you currently using the onboard memory of the PCI-6115? Currently, pretriggering is not supported in this mode. Please see the following Knowledge Base article for more information.
    How Do I Use the NI 6115 and NI 6120 Onboard Memory to Store Acquisition Data for Later Retrieval?
    http://digital.ni.com/public.nsf/websearch/9C41971​0B6071A6D86256BD600624B83?OpenDocument
    Regards,
    Justin Britten
    Applications Engineer
    National Instruments

  • Error setting pretrigger samples

    I am having problems acquiring data with pretrigger samples when capturing more than one channel.
    If I trigger and capture on the same channel (tried 1-4) then it works great, regardless of the number of pre-trigger samples set. If I trigger on channel 4 and capture channels 4 and 1 (passed in that order), with no pretrigger samples set, then it works fine. However, if I trigger on channel 4 and capture channels 4 and 1 (passed in that order), with pretrigger samples set, then I get the following error:
    Error -10621 occurred at AI Control. Possible reason(s):
    NI-DAQ LV: The specified trigger signal cannot be assigned to the trigger resource.  
    Searching the forum, I have found a few other people that had the
    same
    problem
    but they did not have solutions. Any ideas?
    Solved!
    Go to Solution.

    What version of the DAQmx driver are you using?  Both of those posts that you referenced are rather old, and I know that there was an issue in past versions of DAQmx that was similar to what you are describing.  However, it should be fixed if you upgrade to the latest driver (9.0.2, as of right now).  
    -Christina

  • Use of Impact Test with SW Trigger(DAQmx) vi

    Hello,
    I working on modal analysis (with hammer) and so I am trying to use Impact Test with SW Trigger(DAQmx) vi but I don't get signal of the acceleration (should be acquire as voltage), whereas I get the impact. And when I impact the beam I have an error message which says the sampling frequency should be more than 0.
    thanks for your help

    Hi,
    Can you check the "physical channels (stimulus and response)" input to ensure that you have at least 2 signals? I get this error when I am selecting only one channel.
    Hope this helps,
    Charlotte F. | CLAD
    National Instruments France
    #adMrkt{text-align: center;font-size:11px; font-weight: bold;} #adMrkt a {text-decoration: none;} #adMrkt a:hover{font-size: 9px;} #adMrkt a span{display: none;} #adMrkt a:hover span{display: block;}
    >> "Du 11 octobre au 17 novembre, 2 sessions en parallèle : bien démarrer - approfondir vos connais...

  • Multi-buffered acquisition with digital trigger

    I have a PCI-MIO-16E1 and I need to do three channel (250KHz/channel - ~400 scans/trigger) multi-buffered acquisition with digital trigger (trigger => 30 Hz).
    I could not find any example of multi-buffered acquisition. Could anybody help me?

    Hello,
    I assume that you are refering to a retriggering setup where each time you recieve a trigger you take 400 samples on each channel at a rate of 250kHz per channel (total scan rate = 3CH * 250kHz = 750kHz).
    In order to keep the system hardware timed you can use the two counters on the board to produce a retriggerable pulse train that will act as your scan clock. For example each time the counter recieves a trigger it will output a clock signal of 750kHZ with 400 or so pulses in order to take ~400 scans/trigger.
    This clock signal can then act as the scan clock for your 3 channel analog input operation.
    Now we have to figure out how to set up the retriggerable pulse train from the counters and have the analog input use the counter output as a sca
    n clock.
    Good thing there is an example that is already written
    http://zone.ni.com/devzone/explprog.nsf/6c163603265406328625682a006ed37d/aab61e455564a04d862568930018e725?OpenDocument.
    Good Luck.

  • After reading and resetting everything with Keyboard I still get blank white screen. The only way I can boot to Mavericks is unplug power cord, push and hold power button while plugging power cord in. Fans at full speed.

    After reading and resetting everything with Keyboard I still get blank white screen on 2nd? page of boot. The only way I can boot to Mavericks is unplug power cord, push and hold power button while plugging power cord in. Fans run at full speed, machine boots then runs normal except the dvdrw will not . The mid 2011 IMAC had the same problem with LION. I changed hard drives, formatted, and installed a clean install of latest os x mavericks. Any help would be greatly appreciated.
    EtreCheck version: 1.9.15 (52)
    Report generated August 30, 2014 at 6:56:41 PM EDT
    Hardware Information: ?
        iMac (21.5-inch, Mid 2011) (Verified)
        iMac - model: iMac12,1
        1 2.5 GHz Intel Core i5 CPU: 4 cores
        4 GB RAM
    Video Information: ?
        AMD Radeon HD 6750M - VRAM: 512 MB
            iMac 1920 x 1080
    System Software: ?
        OS X 10.9.4 (13E28) - Uptime: 0 days 0:16:53
    Disk Information: ?
        ST3120026AS disk0 : (120.03 GB)
        S.M.A.R.T. Status: Verified
            EFI (disk0s1) <not mounted>: 209.7 MB
            Untitled (disk0s2) / [Startup]: 119.17 GB (87.12 GB free)
            Recovery HD (disk0s3) <not mounted>: 650 MB
        HL-DT-STDVDRW  GA32N 
    USB Information: ?
        Apple Inc. FaceTime HD Camera (Built-in)
        CHICONY USB NetVista Full Width Keyboard
        Apple Inc. BRCM2046 Hub
            Apple Inc. Bluetooth USB Host Controller
        Apple Computer, Inc. IR Receiver
        Apple Internal Memory Card Reader
    Thunderbolt Information: ?
        Apple Inc. thunderbolt_bus
    Gatekeeper: ?
        Anywhere
    Kernel Extensions: ?
        [loaded]    com.nvidia.CUDA (1.1.0) Support
        [loaded]    com.sophos.kext.sav (9.0.61 - SDK 10.7) Support
        [loaded]    com.sophos.nke.swi (9.0.53 - SDK 10.8) Support
    Startup Items: ?
        CUDA: Path: /System/Library/StartupItems/CUDA
        FanControlDaemon: Path: /Library/StartupItems/FanControlDaemon
    Launch Daemons: ?
        [loaded]    com.adobe.fpsaud.plist Support
        [running]    com.arcsoft.eservutil.plist Support
        [running]    com.bjango.istatmenusdaemon.plist Support
        [loaded]    com.oracle.java.Helper-Tool.plist Support
        [running]    com.sophos.autoupdate.plist Support
        [running]    com.sophos.configuration.plist Support
        [running]    com.sophos.intercheck.plist Support
        [running]    com.sophos.notification.plist Support
        [running]    com.sophos.scan.plist Support
        [running]    com.sophos.sxld.plist Support
        [running]    com.sophos.webd.plist Support
    Launch Agents: ?
        [running]    com.arcsoft.esinter.plist Support
        [running]    com.bjango.istatmenusagent.plist Support
        [loaded]    com.nvidia.CUDASoftwareUpdate.plist Support
        [loaded]    com.oracle.java.Java-Updater.plist Support
        [running]    com.sophos.uiserver.plist Support
    User Login Items: ?
        Macs Fan Control
        Firefox
    Internet Plug-ins: ?
        FlashPlayer-10.6: Version: 14.0.0.176 - SDK 10.6 Support
        Flash Player: Version: 14.0.0.176 - SDK 10.6 Support
        QuickTime Plugin: Version: 7.7.3
        JavaAppletPlugin: Version: Java 7 Update 67 Check version
        Default Browser: Version: 537 - SDK 10.9
    Audio Plug-ins: ?
        BluetoothAudioPlugIn: Version: 1.0 - SDK 10.9
        AirPlay: Version: 2.0 - SDK 10.9
        AppleAVBAudio: Version: 203.2 - SDK 10.9
        iSightAudio: Version: 7.7.3 - SDK 10.9
    iTunes Plug-ins: ?
        Quartz Composer Visualizer: Version: 1.4 - SDK 10.9
    3rd Party Preference Panes: ?
        CUDA Preferences  Support
        Fan Control  Support
        Flash Player  Support
        Java  Support
    Time Machine: ?
        Time Machine not configured!
    Top Processes by CPU: ?
             1%    WindowServer
             1%    fontd
             0%    firefox
             0%    SystemUIServer
             0%    SophosWebIntelligence
    Top Processes by Memory: ?
        229 MB    firefox
        156 MB    SophosScanD
        152 MB    InterCheck
        131 MB    com.apple.IconServicesAgent
        115 MB    SophosAntiVirus
    Virtual Memory Information: ?
        424 MB    Free RAM
        1.53 GB    Active RAM
        1.37 GB    Inactive RAM
        699 MB    Wired RAM
        1.26 GB    Page-ins
        0 B    Page-outs

    I'd start by getting rid of the following software responsible for these extensions.
    Kernel Extensions: ?
        [loaded]    com.nvidia.CUDA (1.1.0) Support
        [loaded]    com.sophos.kext.sav (9.0.61 - SDK 10.7) Support
        [loaded]    com.sophos.nke.swi (9.0.53 - SDK 10.8) Support
    Startup Items: ?
        CUDA: Path: /System/Library/StartupItems/CUDA
        FanControlDaemon: Path: /Library/StartupItems/FanControlDaemon
    Use the uninstaller provided with the Sophos software. You can uninstall CUDA via the preference pane. Be sure you remove the com.nvidia.CUDA extension which is located in the /System/Library/Extensions/ folder. Not sure if Fan Control has an uninstaller so you will have to do it manually:
    Uninstalling Software: The Basics
    Most OS X applications are completely self-contained "packages" that can be uninstalled by simply dragging the application to the Trash.  Applications may create preference files that are stored in the /Home/Library/Preferences/ folder.  Although they do nothing once you delete the associated application, they do take up some disk space.  If you want you can look for them in the above location and delete them, too.
    Some applications may install an uninstaller program that can be used to remove the application.  In some cases the uninstaller may be part of the application's installer, and is invoked by clicking on a Customize button that will appear during the install process.
    Some applications may install components in the /Home/Library/Applications Support/ folder.  You can also check there to see if the application has created a folder.  You can also delete the folder that's in the Applications Support folder.  Again, they don't do anything but take up disk space once the application is trashed.
    Some applications may install a startupitem or a Log In item.  Startupitems are usually installed in the /Library/StartupItems/ folder and less often in the /Home/Library/StartupItems/ folder.  Log In Items are set in the Accounts preferences.  Open System Preferences, click on the Accounts icon, then click on the LogIn Items tab.  Locate the item in the list for the application you want to remove and click on the "-" button to delete it from the list.
    Some software use startup daemons or agents that are a new feature of the OS.  Look for them in /Library/LaunchAgents/ and /Library/LaunchDaemons/ or in /Home/Library/LaunchAgents/.
    If an application installs any other files the best way to track them down is to do a Finder search using the application name or the developer name as the search term.  Unfortunately Spotlight will not look in certain folders by default.  You can modify Spotlight's behavior or use a third-party search utility, EasyFind, instead.
    Some applications install a receipt in the /Library/Receipts/ folder.  Usually with the same name as the program or the developer.  The item generally has a ".pkg" extension.  Be sure you also delete this item as some programs use it to determine if it's already installed.
    There are many utilities that can uninstall applications.  Here is a selection:
        1. AppZapper
        2. AppDelete
        3. Automaton
        4. Hazel
        5. AppCleaner
        6. CleanApp
        7. iTrash
        8. Amnesia
        9. Uninstaller
      10. Spring Cleaning
    For more information visit The XLab FAQs and read the FAQ on removing software.
    Be sure to remove your two Login Items. Finally do this:
    Reinstall Lion, Mountain Lion, or Mavericks without erasing drive
    Boot to the Recovery HD:
    Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
    Repair
    When the recovery menu appears select Disk Utility. After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list.  In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported then click on the Repair Permissions button. When the process is completed, then quit DU and return to the main menu.
    Reinstall Lion, Mountain Lion, or Mavericks
    OS X Mavericks- Reinstall OS X
    OS X Mountain Lion- Reinstall OS X
    OS X Lion- Reinstall Mac OS X
         Note: You will need an active Internet connection. I suggest using Ethernet
                     if possible because it is three times faster than wireless.

  • 870A Fuzion Power has problem with keyboard and mouse movement only in games.

    Hey guys,
    recently built a new system and chose to go with the 870A Fuzion Power mainboard, everything has gone very smoothly execpt for one problem, only when I play games like Crysis 2 ect the mouse seems to jolt around now and again and the keyboard decides to stop responding if I hold down the movement keys, and this is only in game not surfing the web for example. Now, I am using a wireless mouse and keyboard but I plugged in a PS/2 keyboard and the exact same thing happened. I've installed all of the drivers that came with this board and the drivers for the mouse and keyboard. Any of you guys ever had this sort of problem or know how to fix this?
    Thanks.

    I bought a new Macbook pro in june 2010, I didn't have any keyboard or mouse issues prior to upgrading to 10.6.4 supposedly this update was made to fix some issues with keyboard and mouse becoming unresponsive. For me the opposite happened. after the upgrade, my keyboard and mouse (trackpad) becomes sometimes partially unresponsive or totally unresponsive. the only way to solve the problem is by completely turning of the computer and turning back on.. granted it doesn't happen very often.. generally once every about 2-3 weeks but it is still annoying though..
    I didn't have a chance to use the computer too much on the previous version (10.6.3) so I don't know if it is software related or hardware related.. any thoughts?
    Message was edited by: msoued

  • SAP BO 4.1 Webi report sample with prompts to try Restful api

    I was not able to find, in the report demo samples available in the SAP BO 4.1 installation, a Webi report with prompts.
    I found many Webi reports samples but all are without prompts.
    I need at least one Webi report sample with prompts to try the Restful API http://localhost:6405/biprws/raylight/v1/documents/7090/parameters and http://localhost:6405/biprws/raylight/v1/documents/7090/schedules with parameters body.
    Where can I found such webi sample?
    Thanks,
    Riccardo

    As you have BI 4.1 installed, you could design a sample webi report using Webi Rich Client tool.
    Open Webi rich client, select the sample eFashion universe drag few objects in the query and a filter. Set the filter as a prompt and save the report to Enterprise.
    Now you could now use this sample report for your handson on REST SDK.
    -Bhushan

  • How Stop Pop-Up Window: Allow Fullscreen With Keyboard Controls?

    How can I cause the cessation of the pop-up window that asks me, "Allow fullscreen with keyboard controls?" 
    In the last month or two (January- February of 2013), this black, semi-transparent pop-up has appeared every time I go to full screen in the game Battle Pirates on facebook.
    After numerous iterations, this confirmation request has become completely unneccessary and nothing more than an unwelcome annoyance.

    Tom,
    Moderators have the authority and privilege to mark answers as correct, in addition to the original posters. ANY moderator here could have marked it that way.
    The Bug report/Feature Request link is not a "vote" page per say, but a place to submit a request for a feature you'd like to see added or dropped from Flash Player. It's the best way to voice a concern or "wish" for a feature, since the development team reads the reports/requests. Management who'd make the decision to add or remove something won't read about it here. They WILL hear about it from development.

  • TS1381 My left arrow does not work on my macbook pro(model A1226).  I have reset nvram, performed a safe boot, pulled the cache to desktop, replaced .globalpreference.plist, test all other keys with keyboard view (all others work)  - HELP!!

    My left arrow does not work on my macbook pro(model A1226).
    I have reset nvram, performed a safe boot, pulled the cache to desktop, replaced .globalpreference.plist, & tested all other keys with "keyboard viewer" (all other keys work except for the arrow). 
    In addition, I have gone thru all the recommended checks with universal access and have booted from snow leopard dvd and the left arrow still does not work. 
    I have tried using the left arrow key in all of applications I use such as: excel, ms word, address book, calendar, iphoto, terminal, & highlighting an icon and using the arrows to move to another selected icon.
    Here is the kicker!  In addition, I purchased a logitech solar bluetooth keyboard and the arrows work fine with my ipad but do not work when paired with the macbook pro. All other keys work fine on the macbook pro using the bluetooth keyboard.
    I believe this says that the problem is not in my macbook pro keyboard. So where can it be?
    Can anyone think of any other rabbit holes I can search?
    thanks and regards
    vats3

    I would also like to add that I've reverted the two cd drive and hard drive mods I did and the laptop is back to factory hardware and there is 0 corrosion or mold visible.

  • How to Create a table with numeric trigger for INSERT

    Let me start off by saying that I am very new to DBMS.
    I need to create a Table with INSERT Trigger. I am not exactly sure if I need to have a BEFORE ot AFTER insert trigger but leanning towards AFTER.
    I have a Java code that will need insert a row each time that piece of code is executed. I would also like an oracle trigger to insert a unique numeric value (REC_ID) for that that record.
    I am totally lost and I am not sure how to go about it. Can you point me to the right direction?
    Basically my table will have the following 3 columns
    REC_ID NUMBER NOT NULL (uniquie value inserted by the trigger)
    PROPERTY_NAME VARCHAR2(100 BYTE)
    PROPERTY_VAL VARCHAR2(100 BYTE)
    Thank you in advance
    Eric

    Take a look at the following: Also please do a search in this forum.
    http://infolab.stanford.edu/~ullman/fcdb/oracle/or-jdbc.html

  • Who can help me with a trigger?

    Hi, I've got a little problem with my database that can be solved, or so I think, with a trigger. First of all, here it is.
    create table utente
    (id_utente number(5) Primary Key,
    nome varchar2(40),
    sexo varchar2(1) check (sexo='M' or sexo='F'),
    morada varchar2(60),
         data_nascimento date,
         contacto number(10),
         numero_BI number(9)
    create table servico
    (id_servico number(5) Primary Key,
         descricao varchar2(40),
         valor number(5),
         data_inicio date,
    data_fim date,
    check (data_fim>=data_inicio)
    create table modalidade
    (id_modalidade number(5) Primary Key,
         descricao varchar2(40),
         valor number(5)
    create table quarto
    (id_quarto number(5) Primary Key,
         descricao varchar2(40)
    create table inscricao_servico
    (id_inscricao_servico number(5) Primary Key,
         id_servico number(5) references servico(id_servico),
         id_utente number(5) references utente(id_utente),
         data_pagamento date
    create table inscricao_mod
    (id_inscricao_mod number(5) Primary Key,
         id_modalidade number(5) references modalidade(id_modalidade),
         id_utente number(5) references utente(id_utente),
         data_inscricao date,
         data_cessacao date,
    check (data_cessacao>data_inscricao)
    create table estadia
    (id_estadia number(5) Primary Key,
         id_utente number(5) references utente(id_utente),
         id_quarto number(5) references quarto(id_quarto),
         data_entrada date,
         data_saida date,
    check (data_saida>data_entrada)
    create table pag_mensalidade
         (id_pag_mensalidade number(5) Primary Key,
         id_inscricao_mod number(5) references inscricao_mod(id_inscricao_mod),
         mes_mensalidade number(6),
         data_pagamento date,
         unique (id_inscricao_mod,mes_mensalidade)
    insert into utente values (1, 'Manel', 'M', 'Rua grande', to_date('80.02.02','yy.mm.dd'), 123456789, 687654321);
    insert into utente values (2, 'Artur', 'M', 'Rua pequena', to_date('81.03.04', 'yy.mm.dd'), 223456789, 587654321);
    insert into utente values (3, 'Cardoso', 'M', 'Rua estreita', to_date('82.04.05', 'yy.mm.dd'), 323456789, 487654321);
    insert into utente values (4, 'Abílio', 'M', 'Rua larga', to_date('79.07.06', 'yy.mm.dd'), 423456789, 787654321);
    insert into utente values (5, 'Antunes', 'M', 'Rua nova', to_date('79.06.01', 'yy.mm.dd'), 423557982, 387654822);
    insert into modalidade values (1, 'Total', 800);
    insert into modalidade values (2, 'Diurno ate 18', 600);
    insert into modalidade values (3, 'Diurno ate 22', 700);
    insert into quarto values (1, '412');
    insert into quarto values (2, '413');
    insert into quarto values (3, '414');
    insert into quarto values (4, '415');
    insert into quarto values (5, '416');
    insert into servico values (1, 'Excursao a Fatima', 150, to_date('11.05.13', 'yy.mm.dd'), to_date('11.05.13', 'yy.mm.dd'));
    insert into servico values (2, 'Ida ao cinema', 10, to_date('11.08.22', 'yy.mm.dd'), to_date('11.08.22', 'yy.mm.dd'));
    insert into servico values (3, 'Apoio domiciliario', 100, to_date('11.07.01', 'yy.mm.dd'), to_date('11.07.31', 'yy.mm.dd'));
    insert into estadia values (1, 1, 1, to_date('11.05.05', 'yy.mm.dd'), null);
    insert into estadia values (2, 2, 2, to_date('10.01.02', 'yy.mm.dd'), null);
    insert into estadia values (3, 3, 3, to_date('09.12.15', 'yy.mm.dd'), to_date('10.02.25', 'yy.mm.dd'));
    insert into inscricao_mod values (1, 1, 1, to_date('09.12.15', 'yy.mm.dd'), null);
    insert into inscricao_mod values (2, 2, 2, to_date('11.11.11', 'yy.mm.dd'), null);
    insert into inscricao_mod values (3, 1, 3, to_date('10.04.10', 'yy.mm.dd'), to_date('11.09.21', 'yy.mm.dd'));
    insert into inscricao_servico values (1, 1, 1, null);
    insert into inscricao_servico values (2, 1, 2, to_date('11.10.01', 'yy.mm.dd'));
    insert into inscricao_servico values (3, 2, 4, null);
    insert into inscricao_servico values (4, 3, 5, to_date('10.12.12', 'yy.mm.dd'));
    insert into pag_mensalidade values (1, 1, 201110, to_date('11.10.23', 'yy.mm.dd'));
    insert into pag_mensalidade values (2, 2, 201111, to_date('11.11.27', 'yy.mm.dd'));
    insert into pag_mensalidade values (3, 3, 201112, NULL);
    insert into pag_mensalidade values (4, 1, 201111, NULL);
    drop table estadia;
    drop table inscricao_servico;
    drop table quarto;
    drop table pag_mensalidade;
    drop table inscricao_mod;
    drop table modalidade;
    drop table servico;
    drop table utente;
    Ok, the problem is: the table 'estadia' means 'stay' and 'quarto' means 'room'. I need to, before inserting on 'estadia', to check if that room is available or not.
    I may do this:
    insert into estadia values (4, 3, *3*, to_date('09.12.15', 'yy.mm.dd'), to_date('10.02.25', 'yy.mm.dd'));
    but if, after this command, i do this:
    insert into estadia values (5, 4, *3*, to_date('09.12.15', 'yy.mm.dd'), to_date('10.02.25', 'yy.mm.dd'));
    it accepts and it shouldn't, because I'm putting users 3 and 4 in the same room at the same time.
    the 3rd field is the room id and the next two fields are the entry date (data_entrada) and the exit date (data_saida). If a room is related to a specific stay in which the exit date hasn't gone by, that room shouldn't be available. Also, the exit date may be null, meaning that the exit date is unknown.
    I hope to have been clear about my question.
    Thanks, Chiapa

    This is a fairly easy business rule which can be implemented using triggers. Here goes.
    Tables (my version):
    drop table stay;
    drop table room;
    create table room
    (room_id     number not null primary key
    ,other_col     varchar2(10) not null)
    create table stay
    (stay_id     number not null primary key
    ,room_id     number not null references room(room_id)
    ,arrive          date not null check(trunc(arrive)=arrive)
    ,depart          date          check(trunc(depart)=depart)
    ,unique (room_id,arrive)
    ,check(arrive <= depart))
    /The rule you are trying to implement is this one:
    create or replace assertion no_overlap as
    check(not exists
            (select 'two overlapping stays for a room'
             from stay s1
                 ,stay s2
             where s1.room_id = s2.room_id
               and s1.stay_id != s2.stay_id
               and (s1.arrive between s2.arrive and nvl(s2.depart,s1.arrive) or
                    s1.depart between s2.arrive and nvl(s2.depart,s1.depart))
    /Sometime in a far far away future, we may be done now. That future has still to arrive though.
    So here's the trigger-code and supporting objects:
    create or replace procedure p_get_Lock(p_lockname    in varchar2) as
    pl_id number(38);
    pl_return number;
    pl_timeout number := 0;
    begin
      -- Go get a unique lockhandle for this lockname.
      pl_id := dbms_utility.get_hash_value(name      => p_lockname
                                          ,base      => 1
                                          ,hash_size => power(2,30));
      -- Request the application lock in X-mode.
      pl_return :=
      dbms_lock.request(id                => pl_id
                       ,lockmode          => dbms_lock.ssx_mode
                       ,timeout           => pl_timeout
                       ,release_on_commit => true);
      if pl_return not in (0,4)
      then
        raise_application_error(-20000,'Could not serialize for business rule.');
      end if;
    end;
    create global temporary table stay_te
    (room_id     number not null)
    create or replace trigger stay_aiur
    after insert or update on stay
    for each row
    begin
      if inserting or
         (updating and (:new.room_id != :old.room_id or
                        :new.arrive < :old.arrive or
                        :new.depart > :old.depart))
      then
        insert into stay_te(room_id) values(:new.room_id);
      end if;
    end;
    create or replace trigger stay_aius
    after insert or update on stay
    begin
      for r in (select distinct room_id
                from stay_te)
      loop
        p_get_lock(to_char(r.room_id));
        declare
          p_error varchar2(80);
        begin
          select 'Overlapping stays for room '||to_char(r.room_id)||'.'
          into p_error
          from dual
          where exists
            (select 'two overlapping stays for a room'
             from stay s1
                 ,stay s2
             where s1.room_id = s2.room_id
               and s1.room_id = r.room_id
               and s1.stay_id != s2.stay_id
               and (s1.arrive between s2.arrive and nvl(s2.depart,s1.arrive) or
                    s1.depart between s2.arrive and nvl(s2.depart,s1.depart))
          raise_application_error(-20000,p_error);
        exception when no_data_found then
          null;
        end;
      end loop;
      delete from stay_te;
    end;
    /Haven't tested it, but I think it's all okay.

  • Destructive Samples with Handling Units

    Dear Experts,
    I just wanted to check if there's anyone who has encountered destructive inspection for samples with Handling Units and how this was managed (via enhancements/operational workaround).
    Based on SAP KBA 1771624, destructive sampling will not work for HU due to all or nothing approach. We are currently considering the following options but would like to get your insights on this in case there is a better approach for this problem.
    1. During Goods Receipt, sample usage quantity will be packed in separate HU from the rest of the quantity. This option will work provided that sample usage quantity is known before quality inspection. e.g. I will recieve 100 pcs of MAT A, 15 pcs for sample usage will be packed under HU1 and the remaining 85 pcs under HU2. UD stock posting will be performed in 2 steps, 1st for GI to sample usage for HU2 and 2nd for transfer to unrestricted/blocked/etc. for HU2
    2. Receive full quantity under 1 HU. Complete quality inspection (results recording, ud and stock posting). Unpack the material to be able to perform GI to sample for the quantity that was used for destructive inspection.

    Hi Craig/Vignesh,
    Thank you for your providing your inputs on this. I will take them into consideration.
    I have another option to address this requirement, that is to (1) receive the material into non HU storage location (2) perform UD and stock posting, i.e. GI to sample usage and unrestricted-use/blocked stocks (3) transfer unrestricted-use/blocked stocks to HU managed location.
    Do you think this will be more efficient operationally versus the other 2 options above?
    I am trying to find the most effective way to address this requirement with minimum impact to Logistics operation. Most of our materials are managed in HU and destructive sampling is regularly done so users will be performing the steps in SAP a lot.

Maybe you are looking for

  • A way how to fix the Zen Micro head phone jack prob

    Hi! I am one of the many people that purchased a Zen Micro MP3 player, I loved it until around 6 months of use, an audio shorting problem with the head phone jack, started to repeat it's self every time, that I would plug my head phone's into the Zen

  • Can Flash export VECTOR or outlined text in PDF,Ai or EPS?

    We have a web based flash interface that allows customer to design a custom product online. The problem is that the flash then creates a PDF and that PDF never ACCURATELY matches what the customer designed in the flash application. The line and lette

  • HTTPService Component

    Hello, I am having problems with the following example using php/mysql: http://livedocs.adobe.com/flex/3/html/help.html?content=data_access_2.html#196471 When uploaded on my server, it gives the dreaded "Security Error Accessing URL" message.  I put

  • How do I delete time back ups in time machine?

    I used to be able to go into time machine and delete individual back ups. Now nothing happens. Help.

  • Exporting a Podcast

    Within iTunes: How can I save a Podcast to a CD Additionally, how do I export it to send it as an attachment in an email. Thank you very much, Message was edited by: StyleSupport