Need help getting networked shared variables on compact fieldpoint to work
I'm still a newbie and am trying to get Networked Shared Variables to pass from a VI running on a PC to a VI running on a Compact Fieldpoint. I created a VI that sends a message via a Networked Shared Variable and a VI that receives it. I have them both in the same project. If I run them both on the PC, it works, I can send a message string from the first VI to the Networked Shared Variable and read it in the second VI. I have the second VI turn the LED "A" on and the LED "B" off if I send the string "a", and turn the LED "B" on and the LED "A" off if I send the string "b", and turn them both off if I send anything else. It works as expected if both the VIs are running on the PC. The second VI also continuously blinks the LED "C" so I can verify that it's running.
I "deployed" the second VI to the Compact Fieldpoint as follows:
In Project I dragged the VI from My Computer (under Project: name.lvproj) down and put it under the Compact Fieldpoint name.
I right clicked on Compact Fieldpoint name and verified it was set to "Connect".
I right clicked on the second VI and selected "Deploy".
I started both VIs with the "Run" arrow. At this point I know second VI is running since the LED "C" keeps blinking. But, when I try to send an "a" or "b" nothing happens, so the VI on the Compact Fieldpoint must not be receiving the messages in the Networked Shared Variable.
I also right clicked on Compact Fieldpoint name and selected
"Disconnect". The second VI continued to run since the LED "C" keeps
blinking, but I still can't get messages to pass.
Any help will be greatly appreciated.
I got this to work. I moved the library (.lvlib) containing the Networked Shared Variable to down under the Compact Fieldpoint name. Now it works.
Similar Messages
-
Need help getting Mac driver for HP PSC 1510 that works on XP networked printer
My goal is to use a Mac OS X 10.5 laptop and use a Windows XP networked printer - an HP PSC 1510. So far I have failed.
I downloaded a driver update 1.1.1 from Mac which has version 4.03 of the HP PSC 1500 series family of drivers. However, the documentation states that it is not one that will work with an IP or XP connected printer. The earlier driver that came with Mac OS X 10.5 documentation also says that it will not work with an IP or XP connected printer. This explained why the Mac versions of the HP software applications could not see my printer. I had also tried using the default Postscript generic option presented when I was setting up the network printer on the Mac. My one graphic page printed as ten or twelve text pages of nonsense characters so that was also a failure.
So I have my shared HP PSC 1510 wired (connected) off my Windows XP desktop and shared on my home network. I really want to be able to print to the HP PSC 1510 from my wireless Mac laptop especially now that I am partially disabled and getting up and to the PC printer is painful.
If anyone knows how to make this work properly, or even an acceptable workaround, I would be ever so grateful.Hey , Welcome to the HP Support Forums!
I understand that you're looking for a driver that would allow your HP PSC 750 All-in-One Printer to function for printing and scanning on your Mac OS X 10.10 Computer. I would like to assist you with this today. I am happy to report that the HP printing and scanning driver is offered for your specific model of PSC printer for the newer Mac Operating Systems. Please click here to download the basic print and scan driver. According the the driver page (found here) this driver offers basic scan and print capabilities for Mac OS X 9.1 to Mac OS X 9.2.2, and Mac OS X 10.1.x to Mac OS X 10.2.4 and higher. Once the driver is downloaded please follow the onscreen prompts to complete the installation. Once the installation has completed successfully please test printing and scanning to confirm that your product is functioning as per normal. Please respond to this post with the result of your installation. I look forward to hearing from you. Best of luck! -
Need help getting Fatal1ty Pro Series Gaming Headset Mic to work
greetings.
i am using a Fatal1ty Pro Series Gaming Headset Mic along with an Audigy 2 ZS Notebook card, and i cannot for the life of me get my laptop to recognize audio coming from the mic. the mic switch on the cord is on, and the status light is lit up, and i can even hear my voice from the mic in the headphones, but the audio is not being inputted into the computer. i'm using winxp pro and have played around with all the audio settings in control panel with no luck. any suggestions? i thank you in advance for your time and consideration. take care.
regards,
jpsHeadsets or microphones with a USB connection cannot be connected to the input connections on a sound card directly. Instead, they must be connected to a USB port on a PC.
They are treated as a separate audio device by Windows. They will be listed as a separate audio device in Device Manager as well as in Windows Multimedia panel. To adjust the volume of the headset or the microphone, use Windows Volume Control. -
Happy New Year NI forums!
I am working on a project involving mobile interacting robots. In the future it is likely the application's components may need to run on different PCs (Targets). Note: at this point in time all the components are seperate but all running on the localhost machine. Thinking towards the future I want to pick the 'best' architecture to allow all these components (VIs performing various functions) in multiple locations. For example, several VIs on the Robots, VIs on serveral PCs.
I am currently aware of using Server/Client TCP/IP using named services. My mock up works well, but is it time efficient (my time coding) I wonder.. ?
Whereas I am aware of networked shared variables which handle connections and all the parsing for the underlying tcp/ip communication. But will this be difficult the manage? I am unsure if I can associate shared variables with a VI similar to named services. I suppose I could pro grammatically create the variable upon initialization of the server component - and the client could just search the list of avaiaible variables to connect too. Downside this would require DSC module.
As you can see, I am rather unsure. Any advice would be great!
Kind Regards,
James
Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help!Hi Jason,
Thanks for your reply. I hope your enjoying NI UK as much as I did.. fun times!
I have seen the link you posted a few times before. But today, I took a better look at it.
My issue is I need several multi-client severs, i.e. many servers which allow multiple clients to connect to them.
Now the STM does have an example of this - STM mutli-client Example - Server.vi (used with the STM mutli-client.vi)
However, when a make copies of these code (to have my second server) - it refuses to run. As in , it just stops itself.
I DID change the port number, on the lister aspect of the server code. But I Am unsure what else I would need to change to get this setup to work?
One thought I had was, the FIFOs all having the same name - this probably isn't a good idea between servers.
Any suggestions would be grateful!
*please could you provide me email support
Kind Regards,
James Hillman
Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! -
Network shared variables lose binding
Hello,
I am developing an application in LabVIEW that uses network shared variables to transmit data between two PC's on the same subnet. The shared variables work fine when running the VI's in development mode, however, when i build the vi's into an executable I find that they no longer work. Here is what I have found so far:
I deploy the shared variable library on the publisher machine (also happens to be the development machine) through an invoke node in the executable. NI distributed system manager confirms that this does deploy and indeed updates as it should.
For the executable on the subscriber PC I created a second shared variable library (same project) with the same shared variables and bound them to the respective shared variables from the first library by selecting enable aliasing, then bind to PSP URL and browsing to the shared variable I wish to bind it to (e.g. \\hallnet-ellm2\shared variable library\serial Number). The machines listed under browse were listed by name so when I tried this initially and it did not work I manually changed the name of my machine in the URL box to the IP address of the publisher hoping that would fix it in case the subscriber could not resolve the publishers machine alias. So now my bind URL read \\192.168.0.1\shared variable library\serial Number.
As part of the executable on the subscriber I deploy this second shared variable library. NI distributed system manager confirms that this deploys but under quality for an individual variable it has a list of issues (see attached) and the bound variable is not updating. At this point the publisher shared variables are still functioning fine. By clicking on 'edit variable' I can see that the variable on the subscriber is still bound but the PSP URL is now \\localhost\shared variable library\serial number. Changing the PSP URL on the subscriber to \\192.168.0.1\shared variable library\serial number enables the variable to update as expected.However by this time my executable has already picked up the error and does not function.
I think that the issue lies with the bind URL used on the subscriber as for some reason it does not keep the binding configured in the project and instead changes to 'localhost'. Why is this? Should it not stay bound to the address specified in the project?
I have tried changing the IP addresses in the aliases file so that
[My Computer]
My Computer=localhost
becomes
[My Computer]
My Computer=ip of local machine
This did not help.
The shared variable libraries are included in the build spec to go into the support files directory and they are successfully deployed from there on both publisher and subscriber.
I am using LabVIEW 8.6 on Windows XP
Thanks for any help you may be able to offer,
Lee
Attachments:
distributed system manager.JPG 74 KBHi Lee,
I hope you are well. Thank you for your post. Your application sounds very interesting.
Looking at your issue I was wondering, have you tried lowering your firewalls, as this may be causing the problem.
Also, another option would be to setup a private network. Do you have access to any routers that you could use to link the two machines independent of your IT's infrastructure?
The other thing to try is two other computers entirely. Again, it would be ideal to take them off the network you are on, but it's something to try if my prior suggestion doesn't work. It should work on the original two machines though, and it's likely that different computers won't solve your problems because I suspect the network.
Remember that the client variables must know the location of the variables on the server, so you can't move the server exe around without changing this value.
Make sure to set the network location in the "Bind to Source" option for the client variables.
It is also possible to write a separate piece of code to install on every machine that is responsible for deploying the library and by doing so eliminate the need for programmatically deploying the variables in the original application. However, this won't really help you, because the variables you use in the application have to be the same as the ones deployed in the library, so if you change the library, they'll no longer be linked and they won't receive data. You'd have to create a separate exe for every binding source you wanted to link to, and then have a second, known library for the sake of communication locally on the computer between the ‘deployer’ and the actual application. The main application could then be assigned the responsibility of launching the correct ‘deployer’' if it sees it needs to switch to a different variable binding source. This method is not the most streamlined or effective, but it might work.
Just to let you know, you will need to use the DSC toolkit.
Please find below some knowledge base links that I think you will find helpful in your application.
Using Shared Variables in Executables
How do I Programmatically Change the Data Binding Source for Shared Variables?
I hope this information helps and if you can give these suggestions a go and let me know how you get on, that would be great.
Kind regards,
Prashant M
Applications Engineer
NI UK & Ireland -
Network shared variables reconnecting network dropout
I've got a cRIO unit communicating with a Laptop using Network Shared Variables, with one of them being a 21 index array that is buffered.
The system connects and communicates fine, but occassionally the wireless card in the laptop is losing the signal from the WAP attached to the cRIO.
When this happens the Network Shared Variables never "reconnect" and start receiving values again once the Wireless link is restored. Is this an expected behavior?
When I tried using another industrial WAP instead of the laptop wireless card I do not get the drop-outs.
Ryan Vallieu
Automation System Architect
Solved!
Go to Solution.Hello Ryan,
Thank you for contacting National
Instruments! I have looked into the issue you are experiencing and
wanted to ask you a few more questions. First of all, do you have a
time frame in which you allow for the reconnect? I believe that the
Shared Variables should regain connection after a short period but it
will not necessarily be a very quick process. It may take a few
minutes for the Shared Variables to reconnect.
The other
thing that may be happening is if you have error wires being passed
through the Shared Variables, it is possible that the error is not
being cleared and so it will always see the error and therefore never
reconnect. In this case you will have to filter this error out and
then clear the error in order to utilize the shared variables again.
If
you have any more specific information about your program that may help
us determine the reason for this behavior. Also a screenshot of your
code would also be helpful. Please let me know if you have any further
questions and I will be happy to assist you. I hope this helps!
Thanks!
Bob H
Applications Engineer
National Instruments -
Error during launching executable with network shared variables
Hi,
I am launching an executable which deploys network shared variables before running the application, I am getting the follow error. can someone tell me whats going on.
thanks,
Attachments:
Untitled.png 28 KBMudda,
Is LabVIEW 2010 installed on the PXI chassis or was this program developed on a different computer?
If LabVIEW 2010 was installed on a different computer you may need the 2010 runtime engine on the controller. If the development environment is installed on the PXI controller then you should be fine.
How are you connecting to the PXI chassis is it on the network or do you have it directly connected to your development computer?
If you look at this forum the same error occured when another device on the network was sharing the same IP address.
http://forums.ni.com/t5/Real-Time-Measurement-and/Deployment-Completed-With-Errors-Network-Shared-Va...
Could you try plugging the PXI chassis in directly and see if that resolves the issue or changing the IP address?
Kyle Hartley
RIO Product Support Engineer
National Instruments -
I need help getting my printer to work
I need help getting my printer to work
http://h30434.www3.hp.com/t5/Printer-Networking-and-Wireless/Want-Good-Answers-Ask-Good-Questions/td...
Say thanks by clicking "Kudos" "thumbs up" in the post that helped you.
I am employed by HP -
Inconsiste​nt Network Shared Variables
I will eventually be implementing a controls program on a machine using cfp. Before the cfp gets here, I am getting practice in network shared variables by trying to pass shared variables between two VIs on my computer. I have attached the two VIs and a screen shot of my project. I run a queued state machine and after the initialization routine is done, I run the control portion of the program. The control program is titled 'The4Mprocedure2.vi' and the QSM is titled '4M_QueueDrivenStateMachine'. In the initialization routine of the QSM, 'FALSE' is written to the boolean network shared variable, 'Run_4M_Procedure'. After the initialization routine is done, and a set of certain parameters are met, the QSM writes the value 'TRUE' to 'Run_4M_Procedure'. Ideally, The4Mprocedure2.vi would read the shared variable, and when the value is 'TRUE' The4Mprocedure2.vi would run. The4Mprocedure2.vi has a case statement that causes to run the program when 'Run_4M_Procedure' = TRUE. The4Mprocedure2.vi does not run when the variable is FALSE.
The problem that I am having is that The4Mprocedure2.vi does not always recognize that the value of my shared variable has changed. When the QSM passes the value of 'TRUE' to the controls program, The4Mprocedure2.vi will sometimes still read the network shared variable as FALSE. Sometimes, I have to restart the controls program several times while the QSM is running to ensure that 'TRUE' is passed to the controls portion. Why does my controls program not recognize when the network shared variable changes values?
Message Edited by tquintana55 on 07-14-2008 11:04 AM
Attachments:
The4MProcedure21.vi 87 KB
ProjectScreenShot1.JPG 68 KB
4M_QueueDrivenStateMachine1.vi 131 KBHi tquintana55,
I believe your Issue is related to the methods that LabVIEW subscribes to the shared variables. Here is a link to a related article:
How to Avoid the "0" Value at First Read of a Shared Variable in LabVIEW 8.5.x?
To resolve this you can move your Run_4M_Procedure inside the while loop.
Sappster -
Network Shared Variable Description
Hi,
I've created alot of Network Shared Variables through Project Explorer...and i have also added a description for each one in the shared variable properties screen
Could someone please tell me how i can get access to the description through LabVIEW?
Many thanks
MikeHi attached is a sample of code in which i am viewing a value and also its description.
Ideally id just like to have the channel name once and the description and value be taken off that, rather than if i ever change it , then have to change the input to the description and also the variable displaying the value. Hope that makes sense
Regards
Mike
Attachments:
opctest3Kep for forum.vi 19 KB -
Network-Shared Variable - read string with CVI
I need to read an NSV string with CVI. I have been digging into accessing and writing NSV with CVI, but they are all scalar value. What should I do with strings, clusters and arrays?
'm an employee at National Instruments and I wanted to make sure you didn't miss the Network Variable API that is provided with LabWindows/CVI, the National Instruments C development environment. The the Network Variable API will allow you to easily communicate with the LabVIEW program over Shared Variables (http://zone.ni.com/devzone/cda/tut/p/id/4679). While reading these links, note that a Network Variable and a Shared Variable are the same thing - the different names are unfortunate...
The nice thing about the Network Variable API is that it allows easy interoperability with LabVIEW, it provides a strongly typed communication mechanism, and it provides a callback model for notification when the Network/Shared variable's properties (such as value) change.
You can obtain this API by installing LabWindows/CVI, but it is not necessary to use the LabWindows/CVI environment. The header file is available at C:\Program Files\National Instruments\CVI2010\include\cvinetv.h, and the .lib file located at C:\Program Files\National Instruments\CVI2010\extlib\msvc\cvinetv.lib can be linked in with whatever C development tools you are using.
Thomas N.
Applications Engineer
National Instruments -
When do I need to redeploy a Shared Variable?
I am using 2 network shared variables to share data between cfp-2220s. The shared variables are both clusters of several deifferent data types. Do I need to redeploy the shared variable everytime I add or remove a variable from one of these clusters?
Hello DrewCommPower,
Yes you will have to reconnect the custom control that defines the cluster and redeploy the shared variable.
Wear
National Instruments
Product Support Engineer -
TS1398 I need help getting connected to our home wifi.
I need help getting connected to our home wifi. I've reset network settings, iPhone, and router but the error "unable to join network" keeps coming up. I also double checked the password. Please help
Other possibilities:
Your router firmware is out of date. Check the manufacturer's website for an update
You have MAC (Media Access Control) filtering enabled on the router, that restricts access to "known" devices and the new iPhone is not on the table of known devices
Your router has a setting limiting the number of simultaneous allowed devices
Your routers SSID ("name") is still the default (e.g., LINKSYS, DLINK, NETGEAR, etc). Your phone has encountered other routers with the same name as you have traveled, and the phone is confused as to which router is the real one. If your router's name is still the default you should change it. -
Need help getting from 10.5.8 to 10.6.
need help getting from 10.5.8 to 10.6. i know i'm late to the game!
If you are not sure of what you are doing,If you are worried about losing anything when doing a major systems upgrade/update,
Before embarking on a major OS upgrade, it would be wise, advisable and very prudent if you backup your current system to an external connected and Mac formatted Flash drive OR externally connected USB, Thunderbolt or FireWire 800, Mac formatted hard drive. Then, use either OS X Time Machine app to backup your entire system to the external drive OR purchase, install and use a data cloning app, like CarbonCopyCloner or SuperDuper, to make an exact and bootable copy (clone) of your entire Mac's internal hard drive. This step is really needed in case something goes wrong with the install of the new OS or you simply do not like the new OS, you have a very easy way/procedure to return your Mac to its former working state.
Older version of CarbonCopyCloner found here.
http://mac.filehorse.com/download-carbon-copy-cloner/2734/
Older versions of SuperDuper can be found on the SuperDuper Website and Homepage.
http://www.shirt-pocket.com/SuperDuper/SuperDuperDescription.html
Then, determine if your Mac meets ALL minimum system install requirements.
Mac OS X v10.6 Snow Leopard system requirements
Purchased Installer disc here.
http://store.apple.com/us/product/MC573Z/A/mac-os-x-106-snow-leopard
To install Snow Leopard for the first time, you must have a Mac with:
An Intel processor
An internal or external DVD drive, or DVD or CD Sharing
At least 1 GB of RAM (additional RAM is recommended)
A built-in display or a display connected to an Apple-supplied video card supported by your computer
At least 5 GB of disk space available, or 7 GB of disk space if you install the developer tools.
In addition, see this discussion for more relevant info that you may need if you have any other questions or issues.
Snow Leopard upgrade - keeps Photoshop? -
I've got a period to date report with following columns:
week1 tots, week2 tots, week3 tots, week4 tots, week5 tot, period-to-date tots, year-to-date tots
I have a SELECT statement which totals data for the entire year and separates current period totals
by grouping on the week_nbr . Any date between beginning of year and the end of the previous period will be week 0
The Select statement retursn 6 rows: 1 for each week in period and one with week_nbr = 0 which represents the totals from the beginning of year
to the end of the previous period.
the select statement returns the data correctly . I need help getting the YTD total for (weeks 1 - 5) + (totals for week 0) for each column.
This means that I will have a 7th record containing the YTD totals. ( I am not concerned with the PTD totals)
I tried sum by partition but complex decode statement gave me problems.
CREATE TABLE PERIOD_DATA
( "HOT_DOG_STAND_ID" NUMBER NOT NULL ENABLE,
"WEEK_DATE" DATE,
"NET_SALES2" NUMBER,
"BUNS24434" NUMBER,
"PICKELS_AW38" NUMBER,
"MUSTARD_TB56" NUMBER,
"CHICKENHEADS33" NUMBER,
"PIECES_SOLD34" NUMBER,
"SCRAPS35" NUMBER,
"PIECES_UNACCOUNTED" NUMBER
REM INSERTING into PERIOD_DATA
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('29-DEC-08','DD-MON-RR HH.MI.SSXFF AM'),14301.39,13951.26,3431.13,0,3680,2484,378,818);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('05-JAN-09','DD-MON-RR HH.MI.SSXFF AM'),14651.37,14651.37,3249.55,0,3200,2419,505,276);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('12-JAN-09','DD-MON-RR HH.MI.SSXFF AM'),14169.89,14169.89,2463.53,0,3136,2080,474,582);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('19-JAN-09','DD-MON-RR HH.MI.SSXFF AM'),15864.46,15864.46,3245.49,0,3472,2764,475,233);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('26-JAN-09','DD-MON-RR HH.MI.SSXFF AM'),15961.2,15916.23,3395.51,0,3648,2838,392,418);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('02-FEB-09','DD-MON-RR HH.MI.SSXFF AM'),19066.4,19066.4,4165.07,0,4336,3682,333,321);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('09-FEB-09','DD-MON-RR HH.MI.SSXFF AM'),18415.74,18415.74,4024.74,0,4032,3365,482,185);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('16-FEB-09','DD-MON-RR HH.MI.SSXFF AM'),18014,17849,3486.33,0,3840,3238,374,228);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('23-FEB-09','DD-MON-RR HH.MI.SSXFF AM'),18671.09,18626.12,3729.42,0,3888,2970,353,565);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('02-MAR-09','DD-MON-RR HH.MI.SSXFF AM'),17636,17636,3815,0,3424,2840,490,94);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('09-MAR-09','DD-MON-RR HH.MI.SSXFF AM'),17235.52,17145.58,3897.42,0,3504,2928,421,155);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('16-MAR-09','DD-MON-RR HH.MI.SSXFF AM'),15989.27,15989.27,3372.95,0,3728,3051,369,308);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('23-MAR-09','DD-MON-RR HH.MI.SSXFF AM'),19067.69,18960.41,4152.6,0,4048,3293,442,313);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('30-MAR-09','DD-MON-RR HH.MI.SSXFF AM'),18717.99,18717.99,3923.69,0,4408,3219,593,596);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('06-APR-09','DD-MON-RR HH.MI.SSXFF AM'),17335.16,17335.16,3769.08,0,3928,2997,514,417);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('13-APR-09','DD-MON-RR HH.MI.SSXFF AM'),18967.39,18967.39,4157.76,0,4144,2991,527,626);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('20-APR-09','DD-MON-RR HH.MI.SSXFF AM'),23090.88,23090.88,4427.96,0,5544,4493,560,491);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('27-APR-09','DD-MON-RR HH.MI.SSXFF AM'),24197.98,24132.99,4248.66,0,6680,5190,606,884);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('04-MAY-09','DD-MON-RR HH.MI.SSXFF AM'),20202.21,20137.22,3714.68,0,7052,6170,422,460);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('11-MAY-09','DD-MON-RR HH.MI.SSXFF AM'),18514.48,18514.48,3266.06,0,5508,4178,571,759);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('18-MAY-09','DD-MON-RR HH.MI.SSXFF AM'),18678.68,18678.68,3814.07,0,5824,4345,633,846);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('25-MAY-09','DD-MON-RR HH.MI.SSXFF AM'),17937.18,17937.18,3051.52,0,4844,4986,529,-671);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('01-JUN-09','DD-MON-RR HH.MI.SSXFF AM'),17445.75,17445.75,3079.91,0,5028,4810,656,-438);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('08-JUN-09','DD-MON-RR HH.MI.SSXFF AM'),17327.88,17327.88,3263.29,0,6112,4674,672,766);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('15-JUN-09','DD-MON-RR HH.MI.SSXFF AM'),17241.72,16937.33,3328.27,0,5792,4490,567,735);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('22-JUN-09','DD-MON-RR HH.MI.SSXFF AM'),16625.83,16625.83,3485.18,0,5408,4319,761,328);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('29-JUN-09','DD-MON-RR HH.MI.SSXFF AM'),17002.84,17002.84,3091.09,0,5664,4369,544,751);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('06-JUL-09','DD-MON-RR HH.MI.SSXFF AM'),16339.19,16274.2,3075.3,0,4784,3440,697,647);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('13-JUL-09','DD-MON-RR HH.MI.SSXFF AM'),17165.12,16885.14,3458.03,0,4320,3296,640,384);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('20-JUL-09','DD-MON-RR HH.MI.SSXFF AM'),17029.77,16899.79,3198.91,0,4448,3449,645,354);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('27-JUL-09','DD-MON-RR HH.MI.SSXFF AM'),16596.89,16596.89,3015.54,0,4624,3288,665,671);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('03-AUG-09','DD-MON-RR HH.MI.SSXFF AM'),16468.58,16468.58,2981.35,0,2224,3495,564,-1835);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('10-AUG-09','DD-MON-RR HH.MI.SSXFF AM'),18625.48,18550.5,3524.44,0,4856,3482,578,796);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('17-AUG-09','DD-MON-RR HH.MI.SSXFF AM'),24538.54,24323.55,5580.71,0,5260,3771,608,881);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('24-AUG-09','DD-MON-RR HH.MI.SSXFF AM'),18081.37,18081.37,3533.45,0,5980,3080,553,2347);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('31-AUG-09','DD-MON-RR HH.MI.SSXFF AM'),17183.25,17183.25,3487.12,0,2544,3262,615,-1333);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('07-SEP-09','DD-MON-RR HH.MI.SSXFF AM'),17688.41,17575.29,3424.17,0,4800,3480,591,729);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('14-SEP-09','DD-MON-RR HH.MI.SSXFF AM'),18211.29,18211.29,3806.32,0,3968,3104,527,337);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('21-SEP-09','DD-MON-RR HH.MI.SSXFF AM'),16809.21,16744.22,3014.61,0,4128,3124,710,294);
SELECT HOT_DOG_STAND_ID
, DECODE(TRUNC(week_date , 'iw') ,
to_date('24-AUG-09' , 'dd-mon-rr') , 1 ,
to_date('24-AUG-09' , 'dd-mon-rr') + 7 , 2 ,
to_date('24-AUG-09' , 'dd-mon-rr') + 14 , 3 ,
to_date('24-AUG-09' , 'dd-mon-rr') + 21 , 4 ,
to_date('24-AUG-09' , 'dd-mon-rr') + 28 , 5 , 0) AS week_nbr
, SUM(NET_SALES2) AS net_sales2
, SUM(BUNS24434 ) BUNS24434
, SUM(PICKELS_AW38) PICKELS_AW38
, SUM(MUSTARD_TB56) MUSTARD_TB56
, SUM(CHICKENHEADS33) CHICKENHEADS33
, SUM(PIECES_SOLD34) PIECES_SOLD34
, SUM(SCRAPS35) SCRAPS35
, SUM(PIECES_UNACCOUNTED) * - 1 PIECES_UNACCOUNTED
/*--== Head average net_sales / chickenusage*/
, CASE
WHEN NVL( SUM(ChickenHeads33) / 8 , 0) = 0 THEN 0
ELSE ROUND(SUM(net_sales2) / ( SUM(ChickenHeads33) / 8 ) , 2)
END AS Head_average
/*--=== Efficiency = (ChickenUsage - scrappedDiv8 - unaccountedDiv8) / ChickenUsage) * 100*/
, CASE
WHEN NVL(SUM(ChickenHeads33) / 8 , 0) = 0 THEN 0
ELSE ROUND((((SUM(ChickenHeads33) / 8 ) - ( SUM(scraps35) / 8 ) - (SUM(pieces_unaccounted) / 8 )) / (SUM(ChickenHeads33) / 8 )) * 100 , 2)
END AS efficiency
FROM period_data per
WHERE week_DATE BETWEEN TRUNC(TO_DATE( '24-AUG-09' , 'DD-MON-YY') , 'IY') AND TRUNC(TO_DATE( '24-AUG-09' , 'DD-MON-YY') , 'IW') + 6 + 7 * 4
GROUP BY hot_dog_stand_id
, DECODE(TRUNC(week_date , 'iw') ,
to_date('24-AUG-09' , 'dd-mon-rr') , 1 ,
to_date('24-AUG-09' , 'dd-mon-rr') + 7 , 2 ,
to_date('24-AUG-09' , 'dd-mon-rr') + 14 , 3 ,
to_date('24-AUG-09' , 'dd-mon-rr') + 21 , 4 ,
to_date('24-AUG-09' , 'dd-mon-rr') + 28 , 5 ,
0)
ORDER BY DECODE(TRUNC(week_date , 'iw') , to_date('24-AUG-09' , 'dd-mon-rr') , 1 , to_date('24-AUG-09' , 'dd-mon-rr') + 7 , 2 , to_date('24-AUG-09' , 'dd-mon-rr') + 14 , 3 , to_date('24-AUG-09' , 'dd-mon-rr') + 21 , 4 , to_date('24-AUG-09' , 'dd-mon-rr') + 28 , 5 , 0);The expected results will be:
HOT_DOG_STAND_ID WEEK_NBR NET_SALES2 BUNS24434 PICKELS_AW38 MUSTARD_TB56 CHICKENHEADS33 PIECES_SOLD34 SCRAPS35 PIECES_UNACCOUNTED HEAD_AVERAGE EFFICIENCY
141 7 697067.09 694887.4 139149.91 0 175808 139454 21036 15318 31.72 79.32 You can get these dame results by running endpot-to-endpoint query:
SELECT HOT_DOG_STAND_ID
, max(7) as week_nbr
,sum(NET_SALES2) net_sales2
,sum(BUNS24434 ) BUNS24434
,sum(PICKELS_AW38) PICKELS_AW38
,sum(MUSTARD_TB56) MUSTARD_TB56
,sum(CHICKENHEADS33) CHICKENHEADS33
,sum(PIECES_SOLD34) PIECES_SOLD34
,sum(SCRAPS35) SCRAPS35
,sum(PIECES_UNACCOUNTED) PIECES_UNACCOUNTED
---===== Copied code from outer query
--== net_sales / chickenusage
, CASE
WHEN NVL( sum(ChickenHeads33) / 8 ,0) = 0 then 0
ELSE ROUND(sum(net_sales2)/ ( sum(ChickenHeads33) / 8 ) , 2)
END as Head_average
--=== Efficiency = (ChickenUsage - scrappedDiv8 - unaccountedDiv8) / ChickenUsage) * 100
, CASE
WHEN NVL(sum(ChickenHeads33) / 8 ,0) = 0 then 0
ELSE ROUND((((sum(ChickenHeads33) / 8 ) - ( sum(scraps35) / 8 ) - (sum(pieces_unaccounted) / 8 )) / (sum(ChickenHeads33) / 8 )) * 100, 2)
END as efficiency
from period_data
WHERE week_DATE BETWEEN TRUNC(TO_DATE( '24-AUG-09' ,'DD-MON-YY'), 'IY') AND TO_DATE( '27-sep-09' ,'DD-MON-YY')
group by hot_dog_stand_id;Thanks In AdvanceHi,
Welcome to the forum!
Thanks for posting the CREATE TABLE and INSERT statements; that's very helpful. You could teach something to some people who have been using this forum for years (except that nobody can teach them).
user12335325 wrote:
The expected results will be:
HOT_DOG_STAND_ID WEEK_NBR NET_SALES2 BUNS24434 PICKELS_AW38 MUSTARD_TB56 CHICKENHEADS33 PIECES_SOLD34 SCRAPS35 PIECES_UNACCOUNTED HEAD_AVERAGE EFFICIENCY
141 7 697067.09 694887.4 139149.91 0 175808 139454 21036 15318 31.72 79.32
Do you mean the expected results will include the row above, and that the results will be this row along with the 6 rows you're already getting? (If you wanted just that one row, I suppose you would just run your second query.)
That sound like a job for ROLLUP.
VARIABLE start_date VARCHAR2 (11);
EXEC :start_date := '24-AUG-2009';
SELECT HOT_DOG_STAND_ID
, NVL (CASE
WHEN week_date >= TO_DATE( :start_date, 'DD-MON-YYYY')
AND week_date < TO_DATE( :start_date, 'DD-MON-YYYY') + 35
THEN 1 + FLOOR ( (week_date - TO_DATE( :start_date, 'DD-MON-YYYY'))
/ 7
ELSE 0
END
, 7
) AS week_nbr
, SUM(NET_SALES2) AS net_sales2
, SUM(BUNS24434 ) BUNS24434
, SUM(PICKELS_AW38) PICKELS_AW38
, SUM(MUSTARD_TB56) MUSTARD_TB56
, SUM(CHICKENHEADS33) CHICKENHEADS33
, SUM(PIECES_SOLD34) PIECES_SOLD34
, SUM(SCRAPS35) SCRAPS35
, SUM(PIECES_UNACCOUNTED) * - 1 PIECES_UNACCOUNTED
/*--== Head average net_sales / chickenusage*/
, CASE
WHEN NVL( SUM(ChickenHeads33) / 8 , 0) = 0 THEN 0
ELSE ROUND(SUM(net_sales2) / ( SUM(ChickenHeads33) / 8 ) , 2)
END AS Head_average
/*--=== Efficiency = (ChickenUsage - scrappedDiv8 - unaccountedDiv8) / ChickenUsage) * 100*/
, CASE
WHEN NVL(SUM(ChickenHeads33) / 8 , 0) = 0 THEN 0
ELSE ROUND((((SUM(ChickenHeads33) / 8 ) - ( SUM(scraps35) / 8 ) - (SUM(pieces_unaccounted) / 8 )) / (SUM(ChickenHeads33) / 8 )) * 100 , 2)
END AS efficiency
FROM period_data per
WHERE week_DATE BETWEEN TRUNC(TO_DATE( '24-AUG-09' , 'DD-MON-YY') , 'IY') AND TRUNC(TO_DATE( '24-AUG-09' , 'DD-MON-YY') , 'IW') + 6 + 7 * 4
GROUP BY hot_dog_stand_id
, ROLLUP (
CASE
WHEN week_date >= TO_DATE( :start_date, 'DD-MON-YYYY')
AND week_date < TO_DATE( :start_date, 'DD-MON-YYYY') + 35
THEN 1 + FLOOR ( (week_date - TO_DATE( :start_date, 'DD-MON-YYYY'))
/ 7
ELSE 0
END -- week_nbr
ORDER BY week_nbr
;Notice I simplified the computation of week_nbr.
Some other people have asked questions about hot dog stands recently.
I'm curious; is this from a course? If so, where? What is the textbook (if any)?
Thanks.
Maybe you are looking for
-
Closing Report Preview window closes all parent windows
I have a form 6.0 calling a report 6.0 with several user parameters using run_report_object in preview mode. After the finishing previewing, the user closes the report preview window. Then the preview window closes all the parent windows. Need help!
-
How do I reset my password when I have to sync to a different computer?
-
How do I fix Inconsistent music on Airport Network
First time post. Here is the configuration... 1. Airport Extreme in office (supports MacBook Pro and PC) 2. Airport Express in Master connected to receiver (two speakers) 3. Airport Express in Family Room connected to receiver (4 speakers) 4. Two Air
-
Hello, im new to the forum and have been looking through a lot of posts about machine specs over the past couple of days. Hoping someone can help! I'm looking to buy a budget machine (approx £1500 max) to run CS6. We will be using Illustrator and Pho
-
SQL Server 2012 Edition required for my case??
Hi, I am setting up a SharePoint 2013 BI environment with minimal servers. Below is the configuration: 1) WFE1 - Front End Server Role 2) APP1 - Application Server Role with SSRS 2012, SSAS in SharePoint mode. SQL Server 2012 BI edition is used he