Howto create a ValidateSet with dynamic (runtime) values?

Hi Scripting Guys!
I want to use the auto complete feature in my function for a specific parameter using a "dynamic" validate set (Similar to the Get-Service function and the Name parameter). 
For example, instead of this:
function Test-Function
Param
[ValidateSet("Folder1", "Folder2", "Folder3")]
$Param1
I want to get the validate set populated by a function like all Folders from the C drive :
function Test-Function
Param
[ValidateSet(ls c:\ -Directory | select -ExpandProperty Name)]
$Param1
Any suggestions?
Thanks,
Martin

Funny you should ask. Martin Schvartzman has recently posted an example of exactly
how to use dynamic validate set.
Sam Boutros, Senior Consultant, Software Logic, KOP, PA http://superwidgets.wordpress.com (Please take a moment to Vote as Helpful and/or Mark as Answer, where applicable)

Similar Messages

  • Creating context node with dynamic type

    When we are creating context node thru wizard,  Dictionary type must be filled. I'm trying to create Context node manually.Did any one tried created Context node class with Dynamic type.

    Hi Prasad,
    I have a similar requirement.
    Can you please share with me how did you create context node with dynamic table data?
    Thanks
    Vicky

  • Create SCOM Group with dynamic members about 10minutes !

    in our SCOM 2012 SP1 (CU3) environment with about 800 Windows Agents.
    OperationsDB on a Windows Cluster (2 physical server with 2 processors (six cores). Datawarehouse on separate cluster.
    When i create a group with dynamic members, it took about 10min. During this period all the consoles are busy and freezing. 
    Is that normal ?
    Regards
    Lehugo

    on the management server i got follow eventlog error durung this time: 
    OpsMgr Management Configuration Service failed to execute 'ConfigStoreStatsUpdate' engine work item due to the following exception
    Microsoft.EnterpriseManagement.ManagementConfiguration.DataAccessLayer.DataAccessException: Data access operation failed
       at Microsoft.EnterpriseManagement.ManagementConfiguration.DataAccessLayer.DataAccessOperation.ExecuteSynchronously(Int32 timeoutSeconds, WaitHandle stopWaitHandle)
       at Microsoft.EnterpriseManagement.ManagementConfiguration.SqlConfigurationStore.ConfigurationStore.ExecuteOperationSynchronously(IDataAccessConnectedOperation operation, String operationName)
       at Microsoft.EnterpriseManagement.ManagementConfiguration.SqlConfigurationStore.ConfigurationStore.WorkItemCompleted(IConfigServiceEngineWorkItemHandle workItemHandle, IConfigServiceEngineWorkItemResult workItemResult)
       at Microsoft.EnterpriseManagement.ManagementConfiguration.Interop.SharedWorkItem.ExecuteWorkItem()
       at Microsoft.EnterpriseManagement.ManagementConfiguration.Interop.ConfigServiceEngineWorkItem.Execute()
    System.Data.SqlClient.SqlException (0x80131904): Sql execution failed. Error 50000, Level 16, State 1, Procedure WorkItemMarkCompleted, Line 61, Message: Failed to report work item completion. Work item with id 1888748 is not assigned to service instance 'XXXXXX\Default'
       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
       at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
       at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
       at System.Data.SqlClient.SqlCommand.CompleteAsyncExecuteReader()
       at System.Data.SqlClient.SqlCommand.EndExecuteNonQuery(IAsyncResult asyncResult)
       at Microsoft.EnterpriseManagement.ManagementConfiguration.DataAccessLayer.NonQuerySqlCommandOperation.SqlCommandCompleted(IAsyncResult asyncResult)

  • Has anyone been able to create a HtmlDataTable with dynamic col and rows?

    Has anyone been able to create a HtmlDataTable with dynamic col and rows?
    If so please explain. I am successfully able to dynamically add columns using the getChildren method of the htmldatatable object
    BUT for each new column created no data is displayed.
    I am only able to display data for columns originally created when i clicked and dragged the dataTable icon from the pallette in netbeans visual web kit.
    Any help on this is greatly appreciated. I have been searching the web and these forums for around 8 hours and no one seems to have a working example of this. Lots of similar posts asking how to do it though :(
    Thanks in advance.

    This might be useful: http://balusc.xs4all.nl/srv/dev-jep-dat.html

  • Want to create a PO with negative net value

    We need to create a PO with negative value, so that we can collect money from vendor with reference with one perticular PO. Vendor owes us money for that PO.
    We paid him $100.00 to do service, however he screwed that work and caused damage. Now he owes us $20.00 plus $100.00(we paid him already) = $120.00.
    Is it possible? Please help.

    create a debit note in FI, or via SD.
    or a return PO

  • Prompts with dynamic default values

    I have a request from my client to modify several reports so that two date prompts will have default values populated with the first and last day of the previous month.  All of the reports are currently using custom sql so I have to be able get the dynamic default value in the extended @prompt syntax.  However, I am not able to use any of the sql functions since the functions merely appear as plain text as the default value itself. 
    I have found a few work arounds to achieve the functionality of the dynamic prompts, but I cannot get the actual default value displayed to the user to be dynamic.  Is it possible to achieve this by using only the custom sql?

    Hi Sandeep ,
    Below blog may answer your query .
    Dave’s Adventures in Business Intelligence » Dynamic Dates Part III: Monthly Date Ranges
    Search for And for Last Month?

  • How to create a table with editable column values.

    Hi everyone,
    I think this is very simple but i'm not able to find how to do this. This is my requirement. I need to create a table with n columns and 1 row initially. user should be able to enter data into this table and click of a button should insert data into the data base table. Also there should be a button at the bottom of the table to add 1 row to the table.
    I know how to do the insert to database, but can anyone please let me know how to create a table that allows user to enter data and how to create a add 1 row button?
    Thanks in Advance!

    Raghu,
    Go through the ToolBox tutorial Create Page & Advanced table section of OAF Guide.
    Step 1 - You require to create EO & a VO based on this EO. This EO will be of DataBase table where you want to insert the data.
    Step 2 - Create a Advanced table region. (Refer this Adavanced table section for more on this)
    Step 3 - Attach this VO in the BC4J component of Adavanced Table region.
    Regards,
    Gyan

  • Howto create SCEP profile with ICPU to enroll with MEM server on Lion

    How can I create a profile with iPhone Configuration Utility with SCEP settings that will enroll my iPhone with a MDM server on Lion?
    The reason I want to is because I want to create an enrollment profile which cannot be removed by the user.
    So my idea was to create a profile in the iPhone Configuration Utility with the rigth SCEP settings of my MDM server.
    But I don't know what the settings should be or how to find them.
    Thanks for any help!

    After biting the bullet and ordering more RAM, my computer now is working a ton better. So that must have been the main issue. With 8 GB RAM, I can now even run Parallels fluidly (better than my work PC!) where before simple things like logging in to my MBP after reboot could take forever.
    The place I went to had several other people getting RAM upgrades at the same time as me, so between this and other comments I've seen in discussions here and elsewhere on the Internets, I take it to mean that either Apple should bump up the base RAM on its new machines, and/or stop charging so much for additional RAM.
    I refused to believe a Pro machine bought with Lion installed would come with too little RAM for light to medium usage, but it was apparently the case. I'll mark this as a correct answer and hope some other poor soul will come across this thread and be helped by it.

  • Create configuration guide with IMG object values

    Hello all!
    Is it possible to generate configuration guide not only with the IMG objects but also with IMG object values?
    For instance, if we filled in plant 1000 in customizing, then could this value also be present on the generated configuration guide?
    Regards
    Martin

    Sorry, seems I was unclear with the question.
    I meant the generated word document that can be generated with SOLAR02->Configuration->Generate configuration document.
    Here I can download the objects specified in the configuration tab to a word document with the help of a visual basic macro but the content of the IMG objects does not get downloaded.
    When I look at the macro in the generated word document, this functionality seems to be somewhat supported but I cannot make the system generate the appropriate excel files..

  • How to create a report with dynamic columns

    Hi all,
    I am using Apex 4.0 with Oracle 10g
    I am creating a report and I need to display columns dynamically based on the item values.
    example:
    I have a table employee with columns name, designation, sal
    In the report page i have a select list with designations and when I select a designation from the select list,
    I need to display the names of the employees horizontally,
    like each name as a new column in the report with that particular designation. and same has to continue when I select different designations.
    Can some one help me how we can do that.
    I appreciate your answer
    Thanks,
    Rik

    Essentially you want to write a pl/sql function which returns a varchar2 string. The contents of the string must be a valid sql statement.
    Once you have done this, you need to add a report region as type sql report and you will have the option of writing it as a query or as a function returning query. Choose function returning query and enter in the function call.
    Note your function must be valid, and must be executable by your apex parsing schema.
    example:
    create or replace
    function test_report(   p1_tablename       in varchar2)
    return varchar2
    is
    v_query varchar2(4000);
    begin
    v_query  :=
    'SELECT * from '||p_tablename;
    return v_query;
    end test_report;Edited by: Keith Jamieson on Aug 15, 2011 4:50 PM

  • How to create a function with dynamic sql or any better way to achieve this?

            Hello,
            I have created below SQL query which works fine however when scalar function created ,it
            throws an error "Only functions and extended stored procedures can be executed from within a
            function.". In below code First cursor reads all client database names and second cursor
            reads client locations.
                      DECLARE @clientLocation nvarchar(100),@locationClientPath nvarchar(Max);
                      DECLARE @ItemID int;
                      SET @locationClientPath = char(0);
                      SET @ItemID = 67480;
       --building dynamic sql to replace database name at runtime
             DECLARE @strSQL nvarchar(Max);
             DECLARE @DatabaseName nvarchar(100);
             DECLARE @localClientPath nvarchar(MAX) ;
                      Declare databaselist_cursor Cursor for select [DBName] from [DataBase].[dbo].
                      [tblOrganization] 
                      OPEN databaselist_cursor
                      FETCH NEXT FROM databaselist_cursor INTO @DatabaseName
                      WHILE @@FETCH_STATUS = 0
                      BEGIN       
       PRINT 'Processing DATABASE: ' + @DatabaseName;
        SET @strSQL = 'DECLARE organizationlist_cursor CURSOR
        FOR SELECT '+ @DatabaseName +'.[dbo].[usGetLocationPathByRID]
                                   ([LocationRID]) 
        FROM '+ @DatabaseName +'.[dbo].[tblItemLocationDetailOrg] where
                                   ItemId = '+ cast(@ItemID as nvarchar(20))  ;
         EXEC sp_executesql @strSQL;
        -- Open the cursor
        OPEN organizationlist_cursor
        SET @localClientPath = '';
        -- go through each Location path and return the 
         FETCH NEXT FROM organizationlist_cursor into @clientLocation
         WHILE @@FETCH_STATUS = 0
          BEGIN
           SELECT @localClientPath =  @clientLocation; 
           SELECT @locationClientPath =
    @locationClientPath + @clientLocation + ','
           FETCH NEXT FROM organizationlist_cursor INTO
    @clientLocation
          END
           PRINT 'current databse client location'+  @localClientPath;
         -- Close the Cursor
         CLOSE organizationlist_cursor;
         DEALLOCATE organizationlist_cursor;
         FETCH NEXT FROM databaselist_cursor INTO @DatabaseName
                    END
                    CLOSE databaselist_cursor;
                    DEALLOCATE databaselist_cursor;
                    -- Trim the last comma from the string
                   SELECT @locationClientPath = SUBSTRING(@locationClientPath,1,LEN(@locationClientPath)-  1);
                     PRINT @locationClientPath;
            I would like to create above query in function so that return value would be used in 
            another query select statement and I am using SQL 2005.
            I would like to know if there is a way to make this work as a function or any better way
            to  achieve this?
            Thanks,

    This very simple: We cannot use dynamic SQL from used-defined functions written in T-SQL. This is because you are not permitted do anything in a UDF that could change the database state (as the UDF may be invoked as part of a query). Since you can
    do anything from dynamic SQL, including updates, it is obvious why dynamic SQL is not permitted as per the microsoft..
    In SQL 2005 and later, we could implement your function as a CLR function. Recall that all data access from the CLR is dynamic SQL. (here you are safe-guarded, so that if you perform an update operation from your function, you will get caught.) A word of warning
    though: data access from scalar UDFs can often give performance problems and its not recommended too..
    Raju Rasagounder Sr MSSQL DBA
          Hi Raju,
           Can you help me writing CLR for my above function? I am newbie to SQL CLR programming.
           Thanks in advance!
           Satya
              

  • How to create fillable PDF with dynamic content dropdowns?

    I'm creating a March Madness bracket for people that don't really understand how they work.  What I'd like to do is have dropdowns for each of bracket lines (they would list the teams playing against each other for that game and they would select who they think would win).  I would then like the dropdown for the next game to auto-populate with only the two options for the next round. 
    For example, team A and team B play against each other and teams C and D play against each other.  There are two separate dropdowns, one with A and B as choices and the other with C and D as choices.  The user thinks A and C will win their games, so the next dropdown would only have the options of selecting A and C.  To illustrate:
    AA and B are listed in the dropdown, and the user selects A to win.
    BA or C are listed in the dropdown because the user has selected A and C to win their previous games.
    CC and D are listed in the dropdown, and the user selects C to win.
    D
    I can make the first round dropdowns just fine, but I'm not sure how to conditionally/dynamically populate the second round dropdowns based off of user selections.

    I don't understand your request but my english is not the best.
    But here you can see a script. You can copy this in the first dropdown in the exit-event.
    In this example you will give the first dropdwon the entries
    "123"
    "345"
    "678"
    The first case describes what happens when the user clicks "123" the second drowdown will get the entries "456" and "789".
    When the user clicks "456" the second drowdown will get the entries "123" and "789".
    I think you can adapt this script as you need.
    Hope I could help a little bit,
    Mandy
    switch (xfa.event.newText)
        case "123":
            DropdownListe2.clearItems();
            DropdownListe2.addItem("Please select a value");
            DropdownListe2.addItem("456");
            DropdownListe2.addItem("789");
            DropdownListe2.selectedIndex = 0;
            break;
        case "456":
            DropdownListe2.clearItems();
            DropdownListe2.addItem("Please select a value");
            DropdownListe2.addItem("123");
            DropdownListe2.addItem("789");
            DropdownListe2.selectedIndex = 0;
            break;
        case "789":
            DropdownListe2.clearItems();
            DropdownListe2.addItem("Please select a value");
            DropdownListe2.addItem("123");
            DropdownListe2.addItem("456");
            DropdownListe2.selectedIndex = 0;
            break;
        default:
            break;

  • [Seeking help] How to create a bean with annotations @ runtime?

    I would like 2 create a bean, @ runtime, as below:
    public class A {
      @MyAnnotation(id = "ID")
      private String id = "";
      public String getId() { ... }
      public void setId(String id) { ... }
    }Can anyone tell me how 2 achieve this? I know how 2 create a bean dynamically, however with annotations it is a bit tricky ..
    Cheers!
    Edited by: olove66 on Aug 7, 2009 2:00 AM

    @_@ I guess anyone interested in this topic can turn 2 ASM. Maybe BCEL has not got anything 2 support annotation creation yet.

  • How to create a PDF with substituted key-value and table-values using a template language

    I have about 50 key-values and 10 table-values that I want to substitute into a formatted report template (language can be anything standard, would create a small number of these templates) and then use an Adobe tool to substitute the values into the template and produce a PDF. Preferably the template language would permit some basic conditional logic (if <key #> has value <value> then <show key label here> and <key value here> in close spatial proximity on the form) and permit embedding of a static graphic logo, text with fonts/styles, etc. to produce a polished report but also handle pagination (e.g. enable page breaks or numbering) to be handled automatically.
    What is a recommended template language and product to accomplish this?

    Are you thinking of something like a blank form that you can enter information into, save, and send to another user? If so, what you want is possible. If you want more information, post again and include more details about how you want to use it and how the recipient will use it.

  • How would I create a PDF with dynamic spelling notations intact?

    Hi Everyone,
    Is there a way to print a PDF version of everything I see on the screen when I run the Dynamic Spellcheck in InDesign?  I'd like to send everyone on my staff a PDF proof that includes all of the spelling suggestions. 
    I would be extremely grateful for your help.  Nothing I've tried seems to work, and this forum is my last hope.  Thank you!
    Brian

    Check this site: http://www.kerntiff.co.uk/products-4-indesign/spellproof-id
    Using it, and it works great. There is an option for highlighting words which can be turned off, if you just want the dynamic "squiggles".
    It works with printing, but if you want a PDF you have to create the PDF as a postscript and then distill it.

Maybe you are looking for

  • Safari Crashes Every day and I want to scream

    Hello all. I am having problems with Safari and I have noticed that it occurs all the time I access Invasion Power Board messageboards. At first, it would only do it on one of the boards I frequent twice a day, crashing at the rate of at least once a

  • SSD Sloooow boot windows 7

    Hello, Happy new year. I have replaced  my old sata disk with a ssd disk . Intel 520 240 gb. on my  T520. I have a Windows 7 and a minor Linux partition. Dual boot. I have moved the old image  with Arconis True HD. However, there is a HUGE difference

  • Problem with 8164A drivers

    Hi, I'm controling a 8164A (Agilent) via GPIB-USB controler. I can send simple GPIB messages to the instrument but I can use correctly the VI release by Agilent to execute fast scanning. Is there somebody who can help me ? Tosty

  • JTable  - ComboBox problem

    From using a tutorial from a website.. it places a JComboBox in first column the ComboBox elements are: "item1", "item2", "item3", all rows are given these values. How can I do it such that JComboBox have different values for each row? JTable table =

  • How do you control number of cycles shown on chart

    How do you control number of cycles shown on chart?  I've selected a sweep chart and I'm not seeing the vertical bar on the chart when the program runs.  This is probably because I'm not seeing a full cycle of the periodic signal I'm trying to displa