Return array value based on selection criteria

I have one data field that holds text data similar to below:
"Meeting Room 1 (Projector), Meeting Room 2 (Whiteboard), Meeting Room 3 (Video Conferencing)"
"Meeting Room 3 (LCD Display), Meeting Room 1 (Video Conferencing), Meeting Room 2 (Whiteboard)"
The meeting rooms are not always in the same order, I cant count on Meeting Room 1 being followed by Meeting Room 2 etc.
My objective is to only return the meeting room that has the Whiteboard.
I'm aware that I can use SPLIT to seperate the Meeting Rooms by the comma and place their components into an array.
What I'm not sure how to do is return the meeting room with the Whiteboard when that could be [1] in the Array or [2] or [3] in the array.
I need to return the array value based on its contents. Could someone help me 'search' the array created by the SPLIT command and always return that value with the word 'Whiteboard'

This works
whileprintingrecords;
global stringvar x:='';
global numbervar n:=1;
While n <= Ubound(split('......, Meeting Room X (Whiteboard),..............', ",")) Do
if split('..........., Meeting Room X (Whiteboard), ............', ",")[n] like '*Whiteboard*'
then x:=split('.............., Meeting Room X (Whiteboard), ..............', ",")[n];
n := n + 1;
x;
Just replace my string with your field.
Ian

Similar Messages

  • Return a value based on multiple criteria

    Dear Support Community,
    I am trying to formulate a function so that I am able to return a cell value based on more than one criteria.
    Referring to the attached screen shot, "Local Start Time" refers to the time that a person will start a work shift, and depending on the "sectors" the person's duration of time at work will vary.
    For example, if a person starts work between 07:00am and 07:59am AND the particular shift involves 2 sectors, the allowed time at work is 12H15M. However, given the exact start time, if the shift only involves ONE "sector' the allowed time at work becomes 13H00M etc.
    I am trying to formulate a function whereby I can tell the spreadsheet the local start time AND sectors, and then have the appropriate time returned.
    I hope the above makes sense!
    Thanks
    ST

    Hi ST,
    Print your table and pin it up as a "Ready Reckoner" for humans to refer to.
    Convert your table into a Database, something like this:
    Start
    Finish
    Sectors
    Allowed Duration
    Scenario
    0700
    0759
    1
    13h 0m
    1
    0700
    0759
    2
    12h 15m
    2
    0700
    0759
    3
    11h 30m
    3
    0800
    1259
    1
    14h 0m
    4
    0800
    1259
    2
    13h 15m
    5
    0800
    1259
    3
    12h 30m
    6
    1300
    1759
    1
    13h 0m
    7
    1300
    1759
    2
    12h 15m
    8
    1300
    1759
    3
    11h 30m
    9
    1800
    2159
    1
    12h 0m
    10
    1800
    2159
    2
    11h 15m
    11
    1800
    2159
    3
    10h 30m
    12
    2200
    0659
    1
    11h 0m
    13
    2200
    0659
    2
    10h 15m
    14
    2200
    0659
    3
    9h 30m
    15
    (You may want to check that I have converted correctly)
    Columns A and B have a Custom Format that allows them to be numbers (not Text) with leading zeroes.
    Hide Separator to get rid of the comma
    Show zeroes for Unused Digits to show leading zeroes.
    Then you can enter "Army Time" (24 hour clock with leading zeroes) into a Query table
    Thunderstorms playing havoc here with my internet connection. I will post this now. Watch for the next instalment.
    Regards,
    Ian

  • Returning Different Results Based on Input Criteria

    I have a complex nested select statement. Based on selection criteria I want to return different results. Say for instance I had an input parameter Called Products which could contain a Yes/No Flag. If the Flag was Yes then I would want the "top" select, statement to be The following:
    Select Product, Time_ID, Amt
    From
    My Complex Nested Select
    But if Product was set to "No", I would want the following:
    Select Time_ID, Amt
    From
    My Complex Nested Select
    I know, or course that I can have two COMPLETE set of SQL which are invoked based upon testing the value of the PRODUCT Parameter, but If I duplicate the "inner nested select" then I have 2 sets of select staments to maintain. Is there an alternative to this? Could I make the inner portion which does not change a function of some sort so that my code would look something like this?
    Select Product, Time_ID, Amt
    From
    Execute myNestedSelectFunction
    But if Product was set to "No", I would want the following:
    Select Time_ID, Amt
    From
    Execute myNestedSelectFunction
    This would atleast ensure that I only have to go one place to maintain the logic of the "static Nested Select" statement.
    Just want to make sure I do not have a real viable alternative to "duplicating code"
    Thanks

    Hi,
    Look in TFM for PIPELINED functions which will allow you to:SELECT Product, Time_ID, Amt FROM TABLE(myPipelinedFunctionReturningSelectResult()) T;
    SELECT Time_ID, Amt FROM TABLE(myPipelinedFunctionReturningSelectResult()) T;There are samples if you look on AskTom too.
    Regards,
    Yoann.

  • Syntax for sum in Smart Form based on Selection criteria in Program.

    Hi,
    We have created smart form for printing confirmation entries in desired format. We have given some selection criteria in the program. Now, we want to do the sum of certain fields in the smart form based on selection criteria given in program and selection screen.
    But we are getting wrong sum in the smart form than expected.
    When we debug the program during run time, we are getting correct records as per our expectations. But result of sum in the out put is not as per given selection criteria.
    Do we need to establish link between "select option" and "Smart form"? How can we use internal table created for select option in the smart form?
    Thanks & regards
    Vijay

    Hi,
    There will be no option to sum the values in smartforms, You just have to sum and append the data to internal table and display the internal table data in the form.
    Regards,
    Satish

  • How to populate table of values based on selected value of dropdown list

    Hi
    I have an urgent requirement.
    Whenever I select a value in Dropdownlist, Based on the selected value I need to display serveral values in tabular form.
    I have created a dynamic LOV and created the actionListener
    I have created a table by dragging the ViewObject and i have set the partialTrigger attribute value to the LOV Id.
    Now My doubt is What should I return in the actionListener method
    Thanks

    Hi,
    So get the value what i tried is ,bind the list item of the select one choice ,
    and then i used the method something like this
    UISelectItems see=getSelectItems1();
    System.out.println("Selected Value"+ see.getValue());
    but it returns me something like this
    Selected Value[javax.faces.model.SelectItem@b20090, javax.faces.model.SelectItem@431753]
    Don't know what are those ,hoe can i get the display value.Please help.
    Thanks

  • Key Figure based on selection criteria

    Hi SDNers,
    I have Key figures which  i would like to display based on multiple selection criteria... for this we donot have master data data restricted at the query level it should be at the key figure leve...
    Eg:
    Sales which i would like to display based on SORG,DIV,MATERIal Etc.. Kindly can anyone will help...
    Thanks
    Sonu

    You can create restricted key figures if you want to use the same selection criteria in multiple queries.  In which you can get value for key figure for selcted filters on that perticular key figure.
    If you need it for just one query  you can create a structure and in that structure you can create a new selection which has your restrictions on that key figures.
    Search on help you will get to know hot to create structures and restricted key figures.

  • Person DFF Context Value based on 2 criteria (Business Group and Emp Type)?

    Hello,
    We're implementing HR module into multiple business groups.
    I need to define context value for DFF "Additional Personal Details" based on 2 criteria Business Group ID and Employee Type
    Any idea how to do it?
    Thank you
    Elie

    Hello Elie,
    I am not sure on it,However have you tried creating a context with combination of Business Group and Person Type using merging,
    business_group_id || "_"|| person_type_id And structures would be something like 80_2112 Business Group id = 80 and Person Type id=2112.
    It may resolve your issue if this works out.
    Regards,
    Saurabh

  • How make default values in the selection criteria of BEx query????

    Hi all
    I have to create a brand new query, in the selection criteria(Prompts) I have two prompts. one prompt should show current budget year and second prompt should show next budget year, both prompts are mandatory and default.
    Can any one please let me know how to obtain current and next budget year??? do I need to write any customer exit or do i need to create a offset???
    Two prompts are using same infoobject 0fiscper which is mapped to ECC Table MBEW and field is LFGJA.
    Thanks

    HI sathiyaa,
    so you want to show user with two prompts one will show current year and the other next year value by default.
    //tell me that if you user change the current year value for ex: it will show 2011 by default.. and user changed it to 2009.
    you want to show 2009 year results or 2011 even though he changed the prompt.
    Here i'm considering that even though user changed current year to some other year still you want to show the current year results.
    Create a customer exit variable for calyear with ready for input (checked).
    customer exit code in CMOD :
    when ' customer exit var for cal year'
    IF I_step = 1.
    clear l_S_range.
    l_S_range-low = sy-datum+0(4).
    l_s_range-sign = 'I'.
    L_s_RANGE-opt = 'EQ'.
    ENDIF.
    if i_step = 2.
    data: zyear(4) type c.
    zyear = sy-datum+0(4).
    ex: l_s_range-sign = 'I',
    l_s_range-opt = 'EQ'.
    L_s_range-low = zyear.
    appen l_s_range to e_t_range.
    after this create a variable offset
    create a new selection in the structure, drag the KF and calyear restricted by current year variable . Copy the same selection and insert it as a new selection, go back to the calyear restriction, right clik on the variable. specify variable offset and enter + 1.
    or search in sdn how to create variable offset it will help you
    Regards,
    Ranganath.

  • Returning  'Day' value based on month and year parameters

    Hi,
    Is there a code that would return an end of the month  Day value based on month and year parameters?
    For example if my parameters yield 9 or September for a month value and 08 or 2008 for the year value, can a formula generate a value of 30 (the last day of the given month in the specific year)?
    This way the formula would pick up the different last day of the month in February for the leap years.
    Thank you.
    Vic

    1. Open the formula workshop.
    2. From the Repository Custom Functions, under Crystal and then Date, RIGHT click on cdlastdayofmonth, click on ADD TO REPORT.
    3. Create a new formula, in the formula workshop, under FUNCTIONS, go down the list till you see "CUSTOM FUNCTIONS", expand that till you see cdlastdayofmonth.
    4. In your formula, type cdlastdayofmonth(currentdate)
    5. Save and close and display the formula in your report, you should see 11/30/2008.
    If you want just the day then modify the formula to:
    totext(day(cdlastdayofmonth(currentdate)),0,'','');
    since you have parameters for month and year, do this:
    totext(day(cdlastdayofmonth(date({?year},{?month},01))),0,'','');
    to give you the last day of the month.

  • How to transfer Customers to APO based on selection criteria of Division

    Hello,
    We have to transfer Customer Master specific to one business unit to APO and we don't want to transnfer the Customers of another business units. The differentiation of customers is done at a Distribution Channel & Division level. But we don't have Dist Channel & Division as a Selection criteria in Integration Model(CFM1). 
    The other option od Sales Org. Account Grp are common to other Business units too.
    Please provide your suggestions how we can do this.
    Thanks,
    Ashish

    Ashish
    You can manipulate the CFM1 o/p list using the BadI CIF_INT_MODEL. So you actually select all customers in the integration model and add custom logic in this badI implementation to delete the customers that you dont want to transfer . The updated CFM1 output list will then contain the customers that you want .
    Actually we used this BadI for manipulating the PIR's and BOM IM's and it is working without issues
    Thanks
    Aparna

  • Report based on selection criteria in an Apex collection

    For my current page I have to deal with a horrible "EAV" (Entity-Attribute-Value) table design like this:
    Employee ---< Attribute Value >-- Attribute
    So you might query who works in dept 10 and earns 20000 and was hired om 01-Jan-2007 like this:
    select emp.ename
    from emp
    join attribute_value a1 on a1.empno = emp.empno and a1.att_name = 'DEPT'
    join attribute_value a2 on a2.empno = emp.empno and a2.att_name = 'SALARY'
    join attribute_value a3 on a3.empno = emp.empno and a3.att_name = 'HIREDATE'
    where a1.att_numeric_value = 10
    and   a2.att_numeric_value = 20000
    and   a3.att_date_value = date '2007-01-01';(I said it was horrible!)
    But to make matters worse, the form for entering query criteria is also based on the attributes table as a tabular form:
    select apex_item.display_and_save(1,att_name) att_name
    ,      apex_item.text(2,null) att_value
    from   attributes
    where  att_type = 'EMPLOYEE';The user may enter values for any number of attributes and run the query. So in my example, there maybe be 0, 1, 2 or 3 criteria to use (or more when new attributes are added to the table).
    I can code the report query as a "PL/SQL body returning SQL query" and build a SQL string exactly like my example above - all literal values. Is there any way I could do it that uses bind variables? Given the variable number of bind variables I think I'd need to use DBMS_SQL, but would I be able to integrate that into an Apex report region source? Or is there another way?
    I'm open to any suggestions! (Except "redesign the database": much as I'd like to, I can't.)

    If you are sure of the number of attributes the user will be using as criteria is fixed and will not change, you should able to bind the literals to page items like:
    select emp.ename
    from emp
    join attribute_value a1 on a1.empno = emp.empno and a1.att_name = 'DEPT'
    join attribute_value a2 on a2.empno = emp.empno and a2.att_name = 'SALARY'
    join attribute_value a3 on a3.empno = emp.empno and a3.att_name = 'HIREDATE'
    where a1.att_numeric_value = :P1_dept_value
    and   a2.att_numeric_value = :P1_salary_value
    and   a3.att_date_value = to_date(:P1_hiredate_value,'YYYY-MM-DD');or
    select emp.ename
    from emp
    join attribute_value a1 on a1.empno = emp.empno and a1.att_name = :P1_att1_name
    join attribute_value a2 on a2.empno = emp.empno and a2.att_name = :P1_att2_name
    join attribute_value a3 on a3.empno = emp.empno and a3.att_name = :P1_att3_name
    where a1.att_numeric_value = :P1_att1_value
    and   a2.att_numeric_value = :P1_att2_value
    and   a3.att_date_value = to_date(:P1_att3_value,'DD-MM-DD');What happens when your user wants to add another attribute and use it as search criteria. You have to:
    1) add a JOIN clause to the SELECT
    2) add to the WHERE clause to the SELECT
    Warning personal opinion to follow: I would give up binding (i.e.. skipping parsing os the SELECT statement) for the flexibility of generating the SELECT at runtime. If the user adds a new attribute, then the PL/SQL code that assembles the SELECT statement would not have to be changed. All the meta data is stored in the database as to what the new column is and which column in the attributes table to use (ATT_NUMERIC_VALUE or ATT_DATE_VALUE). If your method of displaying the attributes and receiving the user's criteria is dynamic like my example, then you would not have to change the application at all for new attributes.
    Just my 2 cents worth of opinion,
    Mike

  • Returning a value based on user-supplied sql variables

    I'm using JDeveloper 10.1.3.1, ADF and JSP.
    I want to return a primary key based on values a user enters in unbound fields (like inputText). They'll be entering information for a record including a 10-segment GL code, and when the other bound values are committed, I'd like the associated GL id to be returned for the row (if found). Validation is not necessary at this point. A null return is okay.
    I've defined bind variables in a GL view object - one for each of the 10 segments - plus a jspx form with 10 inputText objects.
    Does it sound like this is going in a logical direction? I'm stuck at this point, and am open to suggestions.

    1. Open the formula workshop.
    2. From the Repository Custom Functions, under Crystal and then Date, RIGHT click on cdlastdayofmonth, click on ADD TO REPORT.
    3. Create a new formula, in the formula workshop, under FUNCTIONS, go down the list till you see "CUSTOM FUNCTIONS", expand that till you see cdlastdayofmonth.
    4. In your formula, type cdlastdayofmonth(currentdate)
    5. Save and close and display the formula in your report, you should see 11/30/2008.
    If you want just the day then modify the formula to:
    totext(day(cdlastdayofmonth(currentdate)),0,'','');
    since you have parameters for month and year, do this:
    totext(day(cdlastdayofmonth(date({?year},{?month},01))),0,'','');
    to give you the last day of the month.

  • Fetch the data from the Data base based on selection criteria in ABAP

    Hi
    I am new to ABAP and working on the Screen where User Enters Company code from and to , Document no and to, I have defined as specified below
      SELECT-OPTIONS Company     FOR p_ccode.
      SELECT-OPTIONS Document    FOR p_fdocnr.
      SELECT-OPTIONS Year           FOR p_fyear.
    When I debug in the pgm I get the values as
    IBT11001100 (From and To Company Code)
    IBT23234241002323424246 (From and To doc no)
    IBT20092009 (From and To Year)
    How can write a SQL select statement to fetch the data from the Database based on the above inputs
    Thanks
    PR

    Moderator message:
    Sorry - this isn't an ABAP training forum. Please press F1 on SELECT-OPTIONS and/or SELECT.
    Thread locked.
    Rob

  • Getting Array value based on another value

    Hi
    Im pretty new to Powershell, havnt tried to code in almost 15 years so Im a Little rusty to say the least. Im trying to make a script where I import a csv file into an array and then use foreach on one value to output another value. An example of the csv
    file could be the following.
    Client,Email,EmailAddresse
    Company1,No,[email protected]
    Company2,Yes,[email protected]
    Company3,Yes,[email protected]
    I have tried the code below to import the csv file into an array and then output the email address where email was set to "Yes"
    $clientlist = Import-Csv E:\Script\Clients.csv
    foreach ($client in $clientlist | where {$_.Email -eq "Yes"})
         Write-host $clientlist.emailaddresse
     When I execute the code I get the following output:
    [email protected] [email protected] [email protected]
    [email protected] [email protected] [email protected]
    What I would like to get is just the one email address in each line, matching the email address from the csv where the value "email" was set to "Yes". What am I doing wrong?
    Thank in advance
    Anders Lausen

    You could just filter using Where-Object without the need for the ForEach.
    Import-Csv E:\Script\Clients.csv | Where {
    $_.Email -eq 'Yes'
    } | Select EmailAddress
    Boe Prox
    Blog |
    Twitter
    PoshWSUS |
    PoshPAIG | PoshChat |
    PoshEventUI
    PowerShell Deep Dives Book

  • ALV - Automatic Adjustable Columns (based on selection criteria)

    Hi,
    I am currently in the process of building a costing report for a number of materials.
    For the output, the columns will be the months, while the rows will pertain to the specific materials (1 or 2 columns for the material text and info).
    For example, the columns of the report will look something like:
    Material  January  February  March u2026.. December
    In the selection-screen, I will have input fields, including posting period range (month) and fiscal year single value.
    If the user enters year 2008 and period 10, I only want 1 column for October, with the other columns not present
    If they enter year 2008 and period 10 to 11, then only columns October and November show be displayed.
    Is this possible in abap ALV programming? If so, how? Are there FMu2019s and object-oriented routes that I can take & if so, what do I do? Please provide code samples if possible.
    Please help.
    Thanks,
    John

    I think you can accomplish this using dynamic internal tables...
    one another alternative is to have rows of months and columns as data... ie
    jan       data1 data2....
    feb
    mar

Maybe you are looking for