VI of the Day (10/20/2009) - Select

Today it is the "Select" function.  A very common task is to select between two values, and this function does that in a tidy little package.  And unlike the case structure, we can easily see what both choices are on the BD.  What you end up with is clean, easy to understand code, what could possibly be wrong with that?  There is one very important difference between the case structure and the select function, the case structure only evaluates the required case, both cases are evaluated in the Select function.  Usually the difference in negligible, or you are choosing between two values that you have calculated anyway.  However, a common case where there could be a difference is choosing between an array and the same array with a new value added.
The memory allocation for Build Array goes on in every loop regardless of whether or not it is the desired outcome.  In a case structure, only necessary allocations are performed.  Don't ask me what this code does or does not do, it is pretty much random. 
One thing I sometimes do, but haven't tested is to have build array in every cycle, but choose to append either the new value built into a single element array or an empty array.  I assume that appending an empty element doesn't force any memory allocations, but I haven't tested it.  I try to stick to case structures now.
Crazy, the array constant is wired to the SR and the node on the while loop, but LV won't show it when I copy.
VIOTD groundrules here.

Ravens Fan nailed it, before the whistle this time.    The implies function seems like a perfect VIOTD, and I may still have to get to it someday.  However, I came across this thread from a more reputable source.
http://forums.ni.com/ni/board/message?board.id=170&message.id=194432&query.id=1230994#M194432
Still, it may prove hard to resist.
As for tomorrow, my single-handed attempt to rescue the US airline industry continues as I am off on another trip.
Edit:  Thanks TST, looks like I came in after the whistle this time...
Message Edited by Darin.K on 10-20-2009 02:16 PM

Similar Messages

  • VI of the Day (11/3/2009) - Decimate 1D Array

    A fairly useful function for today "Decimate 1D Array".  Once I got used to this function, I found myself adapting my code to take advantage of it.  The function is like a dealer for arrays (back from Vegas, sorry), and you resize it to select the number of "hands".  (If you are one of those deal-from-the-bottom-of-deck types, you could reverse the array first).  Part of the getting used to this function phase was realizing that it will only return arrays with the same size, if the array is one element short, all arrays drop the last element.  Sometimes I wish that were a selectable behavior, but I am used to it now.
    I probably use this most often to squeeze my complex data into the curve fitting VIs.  I interleave the real and imaginary components, pass the 1D array, and then decimate to retrieve the components.  No need to keep track or calculate the number of points.
    VIOTD groundrules here. 

    Darin.K wrote:
    I'll guess from the joy of snippet creation and the fact that your controls are displayed as icons means you've recently upgraded. 
    Interesting observation. All I did was drag your snipped (with the plain terminals!) to the diagram of a blank VI and the terminals turned into icons. I guess snippets will adapt to the preferences setting. I never noticed that and I don't really like it! For example it will overlap the terminals connected to the upper "decimate" outputs. Not pretty!
    To be honest, I usually don't bother to change most of the defaults and usually only change the terminal style when the diagram space gets crowded. (Still, I wish there was an option to select a bunch of terminals and change the icon style of the entire group...)
    Yes, we are on SSP and I am typically an early adopter. I took the plunge and do virtually all development in LV2009 these days. No major issues so far.
    LabVIEW Champion . Do more with less code and in less time .

  • VI of the Day (9/3/2009)

    Today I'll throw out a VI that I happened to discover on a random walk through the palettes.  The VI is "Search Ordered Table.vi".  Is it just me, or is it vaguely similar to the "Threshold 1D Array" function (only slightly less functional)?  Is there something we should know about one or the other?   If you check that it returns an integer index, perhaps you have an efficient search method for a sorted array.
    Groundrules for VIOTD here. 

    Darin.K wrote:
    I also had a hunch that threshold array was not doing what (I think) it should.  Why would you go out of your way to require a sorted input array just to turn around and perform a linear search? 
    Threshold array does NOT require a sorted input, but it will only find the first place after "index" where the threshold  is reached. This, together with the index input allows for some fancy and useful code.
    Here's one old example how it could be used.
    ALSO:I suggest to get rid of search ordered table and instead allow an "array is sorted" boolean input for threshold array, similar to my suggestion for search array. (stay tuned for another idea post ). It would avoid duplicate functionality. Search ordered table is relatively uselesslimited anyway, because it only supports DBL.  
    An enhanced "threshold array" would work for everything, eliminating duplicate tools such as "sort ordered table".
    Message Edited by altenbach on 09-03-2009 11:43 AM
    LabVIEW Champion . Do more with less code and in less time .

  • VI of the Day (11/5/2009) - Quotient & Remainder

    Today we have the versatile function "Quotient & Remainder".  This guy finds its way into many a for loop or while loop when you want to repeat a set of indices (say 0,1,2,0,1,2...).  Or, let's say you need to know the fractional part of a number, just divide by 1 and take the remainder, plus you get the integer part as well.  Finally, it's simple to check if a number is even and to pad it to the next even number if necessary.  I am sure there are a few more clever uses.
    VIOTD groundrules here. 
    Message Edited by Darin.K on 11-05-2009 09:07 AM

    Another typical use is an integer division where we need to increment by one in order not to lose the data in the remainder if there is one (e.g. when reshaping a1D array to a 2D array and the last row will be only partially filled.)
    I usually use the following construct.
    Message Edited by altenbach on 11-05-2009 08:00 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    round_up.png ‏1 KB

  • Date chooser day and date not selectable

    Hello,
    Anyone knows how to make the day and date not selectable in
    the datefield or date chooser component???
    It is possible to make any one day not available, but what i
    need is only a single day not selectable..
    For example, i can make every tuesdays of a month not
    selectable But, i need to make for example the Tuesday 3rd only Not
    selectable
    Any help will be greatly appreciated.
    Cordially.
    Gerard.

    Welcome to Apple Discussions
    I believe the problem is that you have US formats for dates. Select the cells/columns that you want your date format to apply to then click the cell format inspector (the 42 in a box icon) & choose Custom… from the cell format drop-down. You will be presented with a box that allows you to make your own format. Click & hold on any of the little "lozenges" in the input bar & move them around. You may need to add a space to get the proper result.

  • Errors when in Month view and how do I show (highlight) the day selected?

    There are some annoying 'bugs' in my ical. When I are working in month view and I select a day in that month to copy or enter an item to there is no indication that ical has that day selected. When I paste some data to that day thinking I have it selected it, it may be in the correct day or in the previously selected day - surely this is an oversight on Apples part or am I missing something here?
    Also sometimes after pasting data to the correct day iCal will 'update' and then send the data back to the day I copied it from!!
    Any help appreciated.
    MAC OS 10.9  on a Mac Mini.

    Hi,
    You don't need to convert to a string and back again to do that.  Use TRUNC to get the right day, and date arithmetic to get the right time, like this:
    UPDATE  fc_gq_source_analysis
    SET     effective_date = TRUNC (sample_date, 'MONTH')
                                 + (sample_date - TRUNC (sample_date))
    WHERE   sample_type  = 'C'
    TRUNC (sample_date, 'MONTH')        is midnight on the 1st of the month that you want.
    sample_date - TRUNC (sample_date)   is the time that you want, expressed as a number of days (e.g., 9/24 of a day).

  • IPhone 4s updated with IOS 8. Not the calendar will not show a full list of dates. Instead it shows the whole month with the list of the day selected. I want to have my full list back. So much easier to scroll thru when making appointments.

    iPhone 4s just updated with IOS 8. Now my calendar does not offer the full list of items by day on the screen. Instead I see the month and below the month are the appointments in a list for the selected day only. I would like the option to have the full list available as it is much easier to scroll thru the list when making appointments.

    Hello memormor,
    Thank you for visiting Apple Support Communities.
    To see the full scrollable list of events, start from the day view (tap on a day), not the month view, then click .
    Calendar at a glance - iPhone
    View a list of events. In month view, tap to see a day’s events. In day view, tap .
    Take care,
    Nubz

  • When I add a new contact number to my iphone 5c  and I try to select the iphone choice is not showing up; and it was working fine the day before. ?

    when I add a new contact number to my iphone 5c  and I try to select the iphone choice is not showing up; and it was working fine the day before. ?Also when I try to send an imessage is not going trough as an imessage, it makes me send it as a message.

    You're using Exchange Active Sync to synchronize contacts and calendars with your company Exchange Server. If the default calendar/address books are set to the Exchange account, it will sync automatically. This is normal.
    Go to Settings>Mail, Contacts, Calendars to change the default address book and calendars to a something else, iCloud or something synced from your home computer instead.

  • Returning all the days in selected Month in a Year using Report Builder

    I am working Report Builder with SharePoint List Data Source. Report builder has to parameters Month and Year. If i select month as March and year as 2014 the report have to display
    March 1 2014 Saturday
    March 2 2014 Sunday
    March 3 2014 Monday
    March 31 2014 Monday
    Can any one help on this, do i have to write this in Dataset Property query, Report Builder Properties or calling any function.....!
    Appreciate if any example query. Thank you

    Hi SPBee,
    If the all fields are already returned by dataset with SharePoint List Data Source, we can directly add filters in your dataset to achieve your requirement.
    Expression: [Month]
    Operator: In
    Value: [@Month]
    Expression: [Year]
    Operator: In
    Value: [@Year]
    If you want to create a report that display the data as you post, we can create a function in SQL Server Management Studio as below:
    IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_NAME ='CalendarTable1' AND ROUTINE_SCHEMA = 'dbo' AND ROUTINE_TYPE='FUNCTION')
    DROP FUNCTION dbo.CalendarTable1
    GO
    CREATE FUNCTION dbo.CalendarTable1
    @StartDate datetime,
    @EndDate datetime,
    @WeekDaysOnly bit = 0,
    @MonthStart bit=0
    RETURNS @CALENDAR TABLE
    Date datetime,
    [Monthname] varchar(20),
    [Dayname] varchar(20),
    [Day] int
    AS
    BEGIN
    ;With Calendar_CTE (Date,[Monthname],[Dayname],[Day])
    AS
    SELECT @StartDate,datename(Month,@StartDate),  DATENAME(dw,@StartDate), DATEPART(day,@StartDate)
    UNION ALL
    SELECT DATEADD(dd,1,Date),datename(month,DATEADD(dd,1,Date)),  DATENAME(dw,DATEADD(dd,1,Date)) ,
    DATEPART(day,DATEADD(dd,1,Date))
    FROM Calendar_CTE
    WHERE DATEADD(dd,1,Date) < = @EndDate
    INSERT INTO @CALENDAR
    SELECT Date,[monthname],[Dayname],[Day]
    FROM Calendar_CTE
    RETURN
    END
    Create two parameters start and end with Date/Time type in the report, then use the query like below in the dataset:
    SELECT * from dbo.CalendarTable1 (@start,@end,0,0)
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Trying to activate a new iPad mini. Keep getting message that activation server can't be reached and to try through iTunes. I can't go back beyond the language choice screen to select iTunes. Two days of trying to activate. Help?

    Trying to activate a new iPad mini. Keep getting message that activation server can't be reached and to try through iTunes. I can't go back beyond the language choice screen to select iTunes. Two days of trying to activate. Help?

    Apple's download AND activation servers are being stressed today with all the downloads/activations. It might be best to wait and try later.

  • Deal of the Day: Select Eminem CDs

    Bonus Deals  of the Day
    Limited quantities. See product detail page for availability.
    Select Eminem CDs
    $5.99
    Karina|Social Media Specialist | Best Buy® Corporate
     Private Message

    Hi there cr_client, 
    As I'm often on the go, having access to working emails is crucial for me! I can understand how frustrating it may be to have to browse a website for the deals that should be so readily available to you. With that said, I'm sad to say that I haven't experienced this issue myself in order to recreate the issue you are describing.
    As some settings may prevent the email from loading at times (such as unless you're connected to Wi-Fi, or you may need to approve the download of the content), have you checked your email settings? I understand that this is likely something you've already done, but thought I should ask just to ensure we cover all bases. 
    Please let me know if you continue to experience this issue! 
    Sincerely, 
    Tasha|Social Media Specialist | Best Buy® Corporate
     Private Message

  • First login of the day.

    Hi everybody, How can I know if the actual login of a user is the first login of the day?
    Regards,

    in STAD you can check the client, user and tcode 'session_manager'... get the lowest time of that date..
    ==>for this you can SUBMIT RSSTAT26...
    now from usr02 you can get the last login..(current login)..
    =>use FM or normal select statement..
    compare these..
    Edited by: Soumyaprakash Mishra on Dec 28, 2009 7:29 PM

  • Get all the values from a multiple select in a multipart form

    Hi there!
    I am using a form with enctype="multipart/form-data" in order to upload files from the form.
    I have read this page: http://commons.apache.org/fileupload/using.html and everything works well for my form.
    The only problem is that I can't get all the values from a "multiple select" html object. I get only one value.
    Using servlets I have used this method:
    public java.lang.String[] getParameterValues(java.lang.String name) But now I have enctype="multipart/form-data" in my form and I can't use this way...
    Is there a way to get all the values of a multi-valued parameter?
    Thanks a lot!
    Stefano

    Hi
    I have got solution for this problem so, I am listing here logic
    assume tag name of html
    <select name="moption" multiple="multiple">
    iterate it in as
    String moption="";
    boolean cnt=true;
    while(itr.hasNext())
    FileItem fi=(FileItem)itr.next();
    if(fi.isFormField())
    if(fi.getFieldName().equals("moption"))
    if(cnt==true)
    moption=fi.getString();
    cnt=false;
    else
    moption=moption+","+fi.getString();
    If wants more help then mail me your problem
    at [email protected]
    Thanks!
    Anand Shankar
    Edited by: AnandShankar on 6 Nov, 2009 12:54 PM

  • I want to convert the day into THAI language

    Hi All,
          I write a simple query using date conversion for THAI language. But the NLS_CALENDAR does not convert the DAY to Thai language but month and year shows in THAI only
    Please give the date format for THAI language.
    Query
    select
    DECODE (:p_language_id,
                   'th', TO_CHAR (sysdate,
                                  'DAY MONTH YYYY',
                                  'NLS_CALENDAR=''THAI BUDDHA'''
                   TO_CHAR (sysdate, 'Day MONTHYYYY') ) dates from dual
    Output:
    FRIDAY    สิงหาคม    2556

    Try this
    alter session set nls_language = 'THAI';
    select to_char (sysdate,'DAY MONTH YYYY')
      from dual;
    NLS_LANGUAGE
    Edit.. Perhaps NLS_DATE_LANGUAGE is much suited for your requirement. Check Hoek's solution.
    Message was edited by: Karthick_Arp

  • Has anyone else had the day view crash calendar in iOS 7.1 on iPad Air?

    I recently updated to iOS 7.1 on my iPad Air (128 GB cellular). When I go to the calendar app and select the new "Day" view, the calendar app crashes.
    I have iCloud calendar and two Google calendars syncing with the device. When I disable all calendars from syncing, I no longer experience a crash in the "Day" view.
    Has anyone else had similar experiences?
    Thanks,
    Fyzel

    Switching to day view doesn't crash calendar but I can't launch the calendar app in iOS 7.1 (on my iPad 2) if synch is in and it was last in day view. It crashes on launch.

Maybe you are looking for

  • Can not find xml file in classpath

    Hi, Can someone tell me how I can please or find a xml file in de webdynpro classpath: I have to place a xml and jar files in the classpath. The jar files are found in the application, but I get the following error: com.sap.tc.webdynpro.services.exce

  • Front Row & Video Podcast Play Count

    I have one of the new Core Duo 20" iMacs. I've found that Front Row does something unexepected. When I watch a video podcast through Front Row, and I mean watch it to the end of the file, the play count in iTunes is not updated. I've checked, and the

  • Differentiate between quantity contract and value contract?

    Hi, How can i differentiate between quantity contract and value contract? The agreement type of contract is  is not MK or WK , its custom created. regards N Banu

  • Business By Design - Small outlook's

    Imagine a system which is self sufficient. All your job as a newbie is to start working on the system and follow a set of instructions after which you can start the magical journey of creating business documents with ease. Does this sum up SAP ERP? N

  • Importing A Combo Banner/Menu Bar And Background Image

    Hi, In one Photoshop file, I've created a banner/menu bar, as well as what I would like to use as the background image for what appears on the remainder of the page. The menu items are not in a box of any sort. And everything is on a separate layer.