Dynamic Logic

Is there a way of having a user type in logic into a textbox
and have it execute? I know that the eval function was removed but
I was hoping there is another method of doing this in Flex 3. This
is for a survey application where someone might type in "Question1
== Question2" as below.
if (Question1 == Question2) {
//do something here
}

I would think this is considered very dangerous from a
security perspective and would not be allowed.

Similar Messages

  • Dynamic logic expression

    Hi Experts, 
    Iu2019m trying to build a routine with dynamic logical expressions but it's now working...
    Basically Iu2019m building a string with the expression, a and after the string it's completed Iu2019m calling a macro that consist in a if.
    if expression eq true
    return true value
    but the value returned by the macro it's always false, even when the logical expression it's true...
    i already tried the logical function BOOLC but apparently my version, ECC 6, doesnu2019t recognize it....
    Below goes the code, if anyone could help me Iu2019ll be appreciated.
    "Macro definition
    DEFINE check_condition.
    IF &1 EQ ABAP_TRUE.
        move 'X' to &2.
      endif.
    END-OF-DEFINITION.
    LOOP AT tab_regras."Rules
        CLEAR: str_cond, lv_result.
        LOOP AT dfies_tab WHERE fieldname CS 'ARGUMENTO'.
          CLEAR: lw_string, str_1, str_2, str_3.
          ASSIGN COMPONENT dfies_tab-fieldname OF STRUCTURE tab_regras TO <fs_field>.
          CHECK <fs_field> IS NOT INITIAL.
          SPLIT <fs_field> AT '/' INTO  str_1 str_2 str_3.
          ASSIGN (str_1) TO <fs_value1>.
    "     ASSIGN (str_2) TO <fs_value2>.
    "      ASSIGN (str_3) TO <fs_value3>.
          IF str_cond IS INITIAL..
            CONCATENATE <fs_value1> str_2 str_3 INTO str_cond SEPARATED BY space.
            CONTINUE.
          ENDIF.
          CONCATENATE str_cond 'and' <fs_value1> str_2 str_3 INTO str_cond SEPARATED BY space."string condition
        ENDLOOP.
        check_condition str_cond lv_result.
        CHECK lv_result EQ 'X'.
    Thanks in advance,
    Best Regards
    João Martins

    It would be helpful if you show us what is the example content of str_cond .
    Anyhow your check looks like you want to compare some condition with value X which abap_true denotes i.e.
    if field_1 = 10 and field_2 = 20 EQ 'X'. 
    endif.
    This doesn't make sense for me or maybe I am missing something which is hidden behid this str_cond . Your left hand side expression value must however be equal to right hand side value. So the conditon will only be true if
    if 'X' = 'X'.
    endif.
    Regards
    Marcin
    PS: please note that in ABAP there is no real boolean value, so you can't have condition like in JAVA or C
    if (true_condition)
    //do something
    you always have to compare two values (here abap_true which is X if fact).
    Edited by: Marcin Pciak on May 24, 2011 3:59 PM

  • A dynamic logic

    Hello friends,
    How can sort below weekdays meaningfully like
    Monday,
    Tuesday,
    Wednesday,
    Thursday,
    instaed.
    There must be a dynamic logic .
    This is the output in the ALV-Grid-Output.
    WD        Nr-Accidents
    Monday        1
    Saturday      2
    Tuesday       4
    Friday       5
    Thursday   3
    Wednesday  4

    WD Nr-Accidents  dayno
    Monday 1       1
    Saturday 2      6
    Tuesday 4       2
    Friday 5          5
    Thursday 3      4
    Wednesday 4  3
    take one extra field in your table (Final internal table).
    when you are populating the Day name that time you fill the DAY no.
    now sort internal table with the DAYNO.
    DAy no<-- you can hide this using no_out = 'X'. when you are filling the catalog.
    WD Nr-Accidents 
    Monday 1      
    Tuesday 4      
    Wednesday 4 
    Thursday 3   
    Friday 5      
    Saturday 2

  • Dynamic Logical Expressions in ABAP: IF (lt_cond)...

    is it possible to have a dynamically constructured logical expression?
    I have a condition I need to use in an IF, but I want to avoid hard-coding, so I dynamicallybuild it.
    for a simple example:
    CONCATENATE ITAB-f1
               'EQ'
               varValue
               INTO lt_cond SEPARATED BY SPACE.
    IF (lt_cond).
      WRITE:/ 'Success'.
    ENDIF.
    Is it possible to do this?
    NL

    I am trying to use the macro to check an IF (cond).
    cond is a dynamically constructed condition.
    The bold part of my code way below is my problem area.
    I'm having no trouble getting COND constructed. But I am having trouble between my macro and the processing as my error always tells me I'm calling my macro without 2 actual parameters. Or when I DEFINE my macro with &1 instead of &1 &2, I get 'incorrect logical expression'.
    I've read all the documentation I can find on this, but i still cannot figure out why my macro is not processing.
    Code is lengthy, but if you can, please help.
    I'm anticipating the output to be 'FAILURE' at this point. I just want the condition COND to be processed.
    data: tabfield(20) type c,
          orcheck type I,
          cond type string.
    DATA: BEGIN OF ITAB_NOTIDX OCCURS 0,
          FIELD LIKE ZDOLTARC02-SEARCHFLD,
          VALUE LIKE ZDOLTARC03-VALUE,
          STRUCTURE LIKE ZDOLTARC02-STRUCTURE,
          AOBJ LIKE ZDOLTARC02-A_OBJ,
          END OF ITAB_NOTIDX.
    DATA: BEGIN OF ITAB_AOBJ OCCURS 0,
          AOBJ LIKE ZDOLTARC02-A_OBJ,
          END OF ITAB_AOBJ.
    DATA: ITAB_AOBJF LIKE ITAB_AOBJ.
    DATA: ITAB_NOTIDXF LIKE ITAB_NOTIDX.
    DATA: varAOBJ LIKE ZDOLTARC02-A_OBJ.
    ITAB_NOTIDXF-FIELD = 'LIFNR'.
    ITAB_NOTIDXF-VALUE = '123'.
    ITAB_NOTIDXF-STRUCTURE = 'BKPF'.
    ITAB_NOTIDXF-AOBJ = 'FI_DOCUMNT'.
    APPEND ITAB_NOTIDXF TO ITAB_NOTIDX.
    ITAB_NOTIDXF-FIELD = 'LIFNR'.
    ITAB_NOTIDXF-VALUE = 'ABC'.
    ITAB_NOTIDXF-STRUCTURE = 'BKPF'.
    ITAB_NOTIDXF-AOBJ = 'FI_DOCUMNT'.
    APPEND ITAB_NOTIDXF TO ITAB_NOTIDX.
    ITAB_NOTIDXF-FIELD = 'LIFNR'.
    ITAB_NOTIDXF-VALUE = '001'.
    ITAB_NOTIDXF-STRUCTURE = 'BKPF'.
    ITAB_NOTIDXF-AOBJ = 'FI_DOCUMNT'.
    APPEND ITAB_NOTIDXF TO ITAB_NOTIDX.
    ITAB_NOTIDXF-FIELD = 'SAKNR'.
    ITAB_NOTIDXF-VALUE = '111'.
    ITAB_NOTIDXF-STRUCTURE = 'BSEG'.
    ITAB_NOTIDXF-AOBJ = 'FI_DOCUMNT'.
    APPEND ITAB_NOTIDXF TO ITAB_NOTIDX.
    ITAB_NOTIDXF-FIELD = 'SAKNR'.
    ITAB_NOTIDXF-VALUE = '222'.
    ITAB_NOTIDXF-STRUCTURE = 'BSEG'.
    ITAB_NOTIDXF-AOBJ = 'FI_DOCUMNT'.
    APPEND ITAB_NOTIDXF TO ITAB_NOTIDX.
    ITAB_NOTIDXF-FIELD = 'KUNNR'.
    ITAB_NOTIDXF-VALUE = 'CCC'.
    ITAB_NOTIDXF-STRUCTURE = 'BSEG'.
    ITAB_NOTIDXF-AOBJ = 'FI_DOCUMNT'.
    APPEND ITAB_NOTIDXF TO ITAB_NOTIDX.
    ITAB_NOTIDXF-FIELD = 'KUNNR'.
    ITAB_NOTIDXF-VALUE = 'DDD'.
    ITAB_NOTIDXF-STRUCTURE = 'BSEG'.
    ITAB_NOTIDXF-AOBJ = 'FI_DOCUMNT'.
    APPEND ITAB_NOTIDXF TO ITAB_NOTIDX.
    LOOP AT ITAB_NOTIDX.
      WRITE:/ ITAB_NOTIDX-FIELD, ITAB_NOTIDX-VALUE, ITAB_NOTIDX-STRUCTURE, ITAB_NOTIDX-AOBJ.
    ENDLOOP.
    DATA: VARFIELDNAME LIKE ZDOLTARC02-FIELD.
    CONCATENATE cond
               INTO Cond.
    SORT ITAB_NOTIDX BY AOBJ FIELD.
    varFieldName = Itab_NOTIDX-FIELD.
    ORCHECK = 0.
    ITAB_AOBJF = 'FI_DOCUMNT'.
    APPEND ITAB_AOBJF TO ITAB_AOBJ.
    LOOP AT ITAB_AOBJ.
       MOVE ITAB_AOBJ-AOBJ TO varAOBJ.
       WRITE:/ varAOBJ.
       LOOP AT ITAB_NOTIDX WHERE AOBJ EQ varAOBJ.
               WRITE:/ 'LOOP TEST'.
            IF ITAB_NOTIDX-FIELD EQ varFieldName.
                 WRITE:/ VARFIELDNAME.
                 IF ORCHECK <> 0.
                 CONCATENATE cond
                                'OR'
                                INTO cond SEPARATED BY SPACE.
                 ENDIF.
                 CONCATENATE ITAB_NOTIDX-STRUCTURE
                        ITAB_NOTIDX-FIELD
                        INTO tabfield.
                 CONCATENATE cond
                        tabfield
                        'EQ'
                        '''' ITAB_NOTIDX-value ''''
                        INTO cond SEPARATED BY SPACE.
                 ORCHECK = ORCHECK + 1.
            ELSE.
                MOVE ITAB_NOTIDX-FIELD TO varFieldName.
              WRITE:/ '2', VARFIELDNAME.
                CLEAR TABFIELD.
              ORCHECK = 0.
              CONCATENATE ITAB_NOTIDX-STRUCTURE
                    varFieldName
                    INTO TABFIELD.
                 CONCATENATE cond
                        'AND'
                        TABFIELD
                    'EQ'
                    '''' ITAB_NOTIDX-VALUE ''''
                        INTO cond SEPARATED BY SPACE.
                    ORCHECK = ORCHECK + 1.
            ENDIF.
       ENDLOOP.
    ENDLOOP.
    CONCATENATE COND
                INTO COND.
    write:/ COND. "constructed properly
    <b>DEFINE my_dynamic_check.
    if &1, &2.
      write:/ 'Success'.
    else.
      write:/ 'Failed'.
    endif.
    END-OF-DEFINITION.
    my_dynamic_check (cond).</b>

  • Dynamic Logical Port for Web Service Client

    Hi *!
    We want to use the same Web Service Client code with different Web Service instances running on different systems. So I need to configure the logical port (especially the URL of the endpoint) dynamically at runtime.
    Please give me a hint, how this is done.
    (we are using WebAS 6.40 SP7)...
    Thanks in advance,
         Frank

    Hi Frank,
    I hope you were able to solve your issue on you own in the meantime.
    I was looking for the answer to this question today. This was the only thread I found on SDN. Unfortunately, it did not contain an answer yet. I was able to figure out a way to set the endpoint address dynamically after searching help.sap.com and after examining the interfaces offered by the Stub (logical port in this case) classes.
    Here's an extract from my code:
    // Connect to JNDI context
    InitialContext ic = new InitialContext();
    // Get reference to web service proxy from JNDI context
    Z_MSC_GET_SCHEDULE_WSDService service =
         (Z_MSC_GET_SCHEDULE_WSDService) ic.lookup("wsclients/proxies/iot-online.de/msc~srv_ejb~proxy/de.iot_online.msc.proxy.ScheduleReaderProxy");
    // Get reference to logical port from web service proxy
    Z_MSC_GET_SCHEDULE_WSD logicalPort = service.getLogicalPort();
    // Set URL of web service Endpoint
    logicalPort._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, "http://<FQDN>:8010/sap/bc/srt/rfc/sap/Z_MSC_GET_SCHEDULE_WSD?sap-client=100");
    This is explained on
    http://help.sap.com/saphelp_nwce10/helpdata/en/45/113a1221337249e10000000a155369/frameset.htm
    You can also set the credentials (username / password) with the method _setProperty.
    Best regards
    Christian

  • Dynamical logical port creation

    Hi
    Is it possible to generate a logical port dynamically at runtime. I only need a logical port once for executing a web service, so I'm looking for a way to minimize administration work.
    Regards, Mathias

    hi gourav,
    thanks for a very helpful.. answer..
    but i am still getting the error Uninstantiated object "subject sidl service" in method IF_SRT_WSP_CONFIG_SIDL~CREATE_CLNT_CFG_FROM_WSDL_D of class CL_SRT_WSP_CONFIG_SIDL'.
    while creating the logical port....i am using endpoint URL from the wsdl ...i also tried seleting the wsdl file while cerating port..
    Also when i tried creting port for another consumer proxy it is working....so this is not a system issue
    what could be the problem

  • Removing Logic / Dynamic logic

    Hello all... this is something I have been thinking about for a few weeks and every once and a while I get inspired to see if I can find a simple solution to a rather annoying (but not critical) problem I am having with a bit of code... and in fact... I run into this more than a few times a year (so hell... maybe there's a design pattern out there somewhere...)
    Anyway... here's the deal.
    I have an EJB that accepts a WDDX string, which I deserialize into a Hashtable (very basic)...
    Then I loop through the Hashtable looking at the keys and in this case I build a dynamic SQL statement based on the keys that are present in the Hashtable.
    So I have a bit of code that looks like this:
    if (key.equalsIgnoreCase("foo")) {
        if (sqlStatement.length() == 0)
            sqlStatement.append("where foo = '" + hash.get(key) + "' ");
        else
            sqlStatement.append("and foo = '" + hash.get(key) + "' ");
    }Of course the above is a very simple example... sometimes I have to look at the value as well...
    Basically... my code gets HUGE! I mean... if I have to check for 20 or so keys... that gets to be a bit crazy... and I hate having to scroll through that much code :)
    So, what I am wondering is... is there a design pattern... technique... method... black magic/black box trick to make this logic more dynamic? What I have been thinking is if I could have a configuration file-like construct... almost like a rules file or something similar to that.
    Any hints, tips, tricks, advice, swift kick in the backside for asking something that is probably very obvious... would be greatly appreciate.
    ./dave

    If you know the keys that you're looking for can't you
    use an array? For Example - put the keys into a
    string[] :
    private String[] keys = new String[] {"aaa", "bbb",
    "ccc", "ddd", "eee", "foo", "ggg", "hhh", "iii"};
    ... snipped ...
    Heh.. thanks! I actually started doing that, but it became as big of a mess as my original concept because... and I know I didn't state this in my example... that I may have to do a bit more complex logic on a key I have in a hash... like if a key is of a certain value... i have to append a String variable so that I can do a certain outter-right join as part of the query I'm building...
    Here's an actual example (snipped from my EJB)
    else if (key.equals("SELECTYEAR")) {
        if (criteria.length() == 0)
            criteria.append("WHERE v.model_yr = '"+value+"' ");
        else
            criteria.append("AND v.model_yr = '"+value+"' ");
        ordIDJoin = "AND o.ord_id = oi.ord_id";
        configIDJoin = "AND oi.veh_config_id = v.veh_config_id";
    else if (key.equals("ORD_STAT_CD"))
        if (value.indexOf(LIST_SEPARATOR) > 0)
            if (criteria.length() == 0)
                criteria.append("WHERE o.ord_stat_cd IN ("+value+") ");
            else
                criteria.append("AND o.ord_stat_cd IN ("+value+") ");
        else
             if (criteria.length() == 0)
                criteria.append("WHERE o.ord_stat_cd = "+value+" ");
             else
                criteria.append("AND o.ord_stat_cd = "+value+" ");So... now (I think) you can see why I need something that can handle a bit more complexity when deciding how to append my sql statement StringBuffer
    Thanks for responding! :)
    ./dave

  • Dynamic Logic for a report:  User Maintained Logic

    Hi All,
    I've come across a requirement that needs to build a report.
    However, the set of definitions defined for the report output might change over time.
    Now every time the Definitions change, the User might have to request the change in the report through a development.
    Is there a way, where the Users can maintain certain set of rules and which can be maintained easily, but also allow the report to dynamically pick up the logic that it needs to process the data to the required output layout.
    To explain a little more in detail;
    Data from ZTABLEA is reported out by issuing each line with a BucketID.
    The report will aggregate the data to each Bucket Levels in output.
    But, The Logic for issuing the ZTABLEA line with a BucketID can change over time.
    So, a ZTABLEA line which was issued a BucketID_1 initially when FIELD1 of ZTABLEA = A,
    can later be assigned to another BucketID when FIELD1 of ZTABLEA = A.
    And this assignment needs to be maintained by the Users.
    Some of these Logics can be complex in the sense that they Could span over several Fields for a condition.
    Please advice. Any and all suggestions are highly appreciated.
    Thanks,
    RK.
    Edited by: RK on Jul 17, 2008 7:16 PM

    Following in from what Kev said.
    There's dynamic SQL available  (which you should put in a TRY...CATCH....ENDTRY block), so they can effectively define a WHERE condition, which would be stored in your table.
    I'd suggest that you have a check when they save the new logic, that the where clause is valid.
    If you need some kind of other dynamic abap look at GENERATE, READ REPORT and other associated keywords in the ABAP help.
    matt

  • How to pass dynamic logical expression to function module

    Hi,
    I'm using FM META_READ_TABLE as below:
    As mentioned above im using META_READ_TABLE FM to get company codes from CSKS table of ECC. Below is the code im using:
       DATA:i_opt type STANDARD TABLE OF RFC_DB_OPT, i_fld type STANDARD TABLE OF RFC_DB_FLD,
           i_res type STANDARD TABLE OF TAB512.
    Constants:   c_expr(72) TYPE c VALUE 'KOSTL EQ COST_CTR', c_fld(5) TYPE c VALUE 'BUKRS'.
      w_opt-text = c_expr.
    w_fld-FIELDNAME = c_fld.
    append: w_opt to i_opt,
            w_fld to i_fld.
    data i_control type STANDARD TABLE OF BBP_CONTROL_RECORD.
    **&&--Get Co code from ECC (CSKS table)
    CALL FUNCTION 'META_READ_TABLE'
      EXPORTING
        QUERY_TABLE          = c_table
    *   DELIMITER            = ' '
    *   NO_DATA              = ' '
    *   ROWSKIPS             = '0'
    *   ROWCOUNT             = '0'
        LOGICAL_SYSTEM       = v1_logsys
      TABLES
        OPTIONS              = i_opt
        FIELDS               = i_fld
        DATA                 = i_res
        CONTROL_RECORD       = i_control.
    however it is giving me 'Communication Error' while executing this piece of code. I guess the problem here is with passing query to i_opt table. obviously the way im doing this is wrong and it has to be dynamic. Could anybody please give me idea how to execute fm with dynamic query i.e., 'KOSTL EQ COST_CTR' where COST_CTR is cost center and an importing parameter to this.please advise.
    Rgds

    The "communication error" would seem more likely to be a problem with an RFC call - does 'META_READ_TABLE" call another function in the remote system?
    We don't have that function module here (is it SRM?) but you should be able to construct your dynamic "where" something like this (p_kostl is the variable in this example):
      data:
        l_where     type text72.
      concatenate
        'KOSTL EQ_'
        p_kostl      "variable
        into l_where.
      translate l_where using '_ '.  "replace underscore with space
    Jonathan

  • Dynamic Logic without using Virtual Characteristics/Key Figures

    Hi,
    I am new to Bex so please do let me know if this can be done without using virtual keys or characteristics.
    Logic should start processing from condition 1 to 4 sequencially.. If condition 2 is true, conditions 3 and 4 should not be processed.
    <u>Conditions</u>
    1. Column A if  Sales value is between  10 - 20
    2. Column B if  Sales value is between  15 - 25
    3. Column C if  Sales value is between  20 - 30
    4. Column D if  Sales value is between  25 - 35
    Scenerio 1 :
    Sales value = 16
    Based on this scenerio, the sales value should be displayed in column A only.

    Guys,
    I agree that this is a solvable problem if there are no overlapping conditions but my requirements do have them. I might have over simplify the problem or maybe there is a better way to do this. Here is the real scenario.
    YTD = Year to Date Sales is the total dollar amount of sales from January 1, XXXX through the last day of the previous month.
    LYTD = Last Year to Date Sales is the total dollar amount of sales from January 1, (XXXX – 1 year) through the last day of the previous month one year prior.
    The order by which the logic will check each customer sites classification is as follows:
    1. New Account
    2. No Purchase
    "A customer site is considered a <b>New Account:</b>
    IF LYTD had zero sales activity
    "A customer site is considered a <b> No Purchase</b>:
    IF a customer site had zero sales activity in the previous 3 months
    <b>AND</b> a customer site had sales activity within the report period (i.e YTD)
    Jan 2007 >>>>>> $100
    Feb 2007 >>>>>> $0
    March 2007 >>>> $0
    April 2007 >>>>> $0
    Jan 2006 >>>>>> $0
    Feb 2006 >>>>>> $0
    March 2006 >>>> $0
    April 2006 >>>>> $0
    <u>Scenerio 1</u>
    I run a report on the 15th of May 2007.
    The first column has the <b>New Account</b> logic. Based on the 2006 sales data,  LYTD is $0 since there is no sales activity from Jan - April 2006. So the sales data will fall under the first column since the new account logic is true.
    The second column has the the <b>No Purchase</b> logic. Based on the 2007 sales data, YTD is $100 since there was sales activity from Jan - April 2007. At the same time the previous 3 months (Feb - April 2007 ) has $0 sales. Based on this logic the sales data will fall under the second column since the no purchase logic is also true.
    Now both the columns have data. This is the overlapping scenario I was referring to.
    That is why I need to process the column logic sequentially. Once a condition is true , I need to break and move on to a new row.
    Thanks
    Message was edited by:
            Nigel K

  • Open Hub: How-to doc "How to Extract data with Open Hub to a Logical File"

    Hi all,
    We are using open hub to download transaction files from infocubes to application server, and would like to have filename which is dynamic based period and year, i.e. period and year of the transaction data to be downloaded. 
    I understand we could use logical file for this purpose.  However we are not sure how to have the period and year to be dynamically derived in filename.
    I have read in sdn a number of posted messages on a similar topic and many have suggested a 'How-to' paper titled "How to Extract data with Open Hub to a Logical Filename".  However i could not seem to be able to get document from the link given. 
    Just wonder if anyone has the correct or latest link to the document, or would appreciate if you could share the document with all in sdn if you have a copy.
    Many thanks and best regards,
    Victoria

    Hi,
    After creating open hub press F1 in Application server file name text box from the help window there u Click on Maintain 'Client independent file names and file paths'  then u will be taken to the Implementation guide screen > click on Cross client maintanance of file name > create a logical file path by clicking on new entiries > after creating logical file path now go to Logical file name definition there give your Logical file , name , physical file (ur file name followed by month or year what ever is applicable (press f1 for more info)) , data format (ASC) , application area (BW) and logical path (choose from F4 selection which u have created first), now goto Assignment of  physical path to logical path > give syntax group >physical path is the path u gave at logical file name definition.
    however we have created a logical path file name to identify the file by sys date but ur requirement seems to be of dynamic date of tranaction data...may u can achieve this by creating a variable. U can see the help from F1 that would be of much help to u. All the above steps i have explained will help u create a dynamic logical file.
    hope this helps u to some extent.
    Regards

  • Dynamic If Statment

    Is it possible to create an if statment with dynamic logical tests?  For example, I have a .csv file that has a file name in the first column, and the columns after that have random tag data.  The first row of the .csv is a header (so it's pretty much just ignored), the second row is the file and tags to be compared to the others, the third row is the header for the file name column and all of the tag category columns after that, and below that are all the files and their tags to be compare row 2 to.  The problem is, not every category of files has the same number of tags, and not all tags may be necessary for the comparison, so I was going to have a dialog window of checkboxes come up listing the header row's non-null tag columns as individual checkboxes.  The if statement would then need to compare all of the selected columns to the other listed files (the on row 4 and below) to find any that contain the exact same tags as the source file (the one in row 2).
    Below is kind of a rough mock-up of what I'm trying to do.
    var baseTag = [];
    baseTag = data[1].split(','); //the comparison row's columns loaded to the baseTag array
    if(checkbox1.value) tag1 = true;
    if(checkbox2.value) tag2 = true;
    if(checkbox3.value) tag3 = true;
    ///etc. etc.///
    //check for any files that match
    for(i=3;i<data.length;i++) { //data being the array containing all the rows of the .csv
         var tag = [];
         tag = data[i].split(',');
         if(baseTag[1] == tag[1] && baseTag[2] == tag[2] && baseTag[3] == tag[3] /*etc*/) { //this needs to be set up so that if tag2 = false, it doesn't do the "baseTag[2] == tag[2]" check; but if it's true, it does check it
              open(tag[0]);
    Anyway, any ideas on how to do this?  I have the feeling it's something simple, but just can't seem to figure it out.  Thanks in advance for any help!
    dgolberg

    Hey Michael, thanks for the reply.  The array labelled "baseTag" holds the data for a single row in a .csv file (for simplicity, we'll say it's the very first row).  The array labelled "tag" holds the data for all the remaining rows of the .csv file.  So for example, the .csv might look something like below when opened with a spreadsheet program:
    File Name
    Tag1
    Tag2
    Tag3
    FileName1.format
    wood
    dark
    strong
    FileName2.format
    wood
    light
    strong
    FileName3.format
    wood
    medium
    light
    FileName4.format
    wood
    dark
    strong
    FileName1.format is the file we're doing the check on using the tag columns to the right, and if it finds a match using those tags, it opens the file listed in column 1.  So the script would need to make sure all tags match the first row's tags (in this example, only FileName4.format would match FileName1.format's tags).  However, there may be instances where I wish to exclude one of the columns from the check (for example, only check for matches of tag 1 and 3).  So this would require that the if statement's check only look for matches of the tag1 and tag3 columns while ignoring Tag2 (so now FileName2.format would also match).  Essentially, instead of being:
    if(baseTag[1] == tag[1] && baseTag[2] == tag[2] && baseTag[3] == tag[3]) {
              open(tag[0]);
    it would then be:
    if(baseTag[1] == tag[1] && baseTag[3] == tag[3]) {
              open(tag[0]);
    if I decide to have it exclude the tag2 column.
    The issue I'm having is making this change to the if statement be dynamic (without a huge mess of inefficient code).  Your mention of a switch statement sounds interesting.  I'm not the greatest programmer yet (pretty much just the really basic stuff) so I hadn't heard about this statement yet; but I'll certainly be looking it up now.  Anyway, hope the info helps clarify it a little better.

  • Header Line Logic for Field Symbols??

    Hi Experts,
    I have the logic
    DATA: Itab  TYPE REF TO DATA.
    FIELD-SYMBOLS: <itab> TYPE STANDARD TABLE.
    CREATE DATA Itab TYPE STANDARD TABLE OF (TABLE_NAME).
    ASSIGN Itab->* TO <itab>.
    Her I had done the dynamic logic
    select (LT_FIELDS)
           into corresponding fields of table <itab>
           from (TABLE_NAME)
          up to 100 rows
           WHERE (LT_WHERE).
    Now I am having all information in <itab>.
    Now I want to take this headerline information of <itab> and populate the same to other structure??
    How to take the <itab> as header line information by looping??

    Hi
    see this and use
    Field Symbols
    Field symbols are placeholders or symbolic names for other fields. They do not physically reserve space for a field, but point to its contents. A field symbol cam point to any data object. The data object to which a field symbol points is assigned to it after it has been declared in the program.
    Whenever you address a field symbol in a program, you are addressing the field that is assigned to the field symbol. After successful assignment, there is no difference in ABAP whether you reference the field symbol or the field itself. You must assign a field to each field symbol before you can address the latter in programs.
    Field symbols are similar to dereferenced pointers in C (that is, pointers to which the content operator * is applied). However, the only real equivalent of pointers in ABAP, that is, variables that contain a memory address (reference) and that can be used without the contents operator, are reference variables in ABAP Objects.
    All operations programmed with field symbols are applied to the field assigned to it. For example, a MOVE statement between two field symbols moves the contents of the field assigned to the first field symbol to the field assigned to the second field symbol. The field symbols themselves point to the same fields after the MOVE statement as they did before.
    You can create field symbols either without or with type specifications. If you do not specify a type, the field symbol inherits all of the technical attributes of the field assigned to it. If you do specify a type, the system checks the compatibility of the field symbol and the field you are assigning to it during the ASSIGN statement.
    Field symbols provide greater flexibility when you address data objects:
    If you want to process sections of fields, you can specify the offset and length of the field dynamically.
    You can assign one field symbol to another, which allows you to address parts of fields.
    Assignments to field symbols may extend beyond field boundaries. This allows you to address regular sequences of fields in memory efficiently.
    You can also force a field symbol to take different technical attributes from those of the field assigned to it.
    The flexibility of field symbols provides elegant solutions to certain problems. On the other hand, it does mean that errors can easily occur. Since fields are not assigned to field symbols until runtime, the effectiveness of syntax and security checks is very limited for operations involving field symbols. This can lead to runtime errors or incorrect data assignments.
    While runtime errors indicate an obvious problem, incorrect data assignments are dangerous because they can be very difficult to detect. For this reason, you should only use field symbols if you cannot achieve the same result using other ABAP statements.
    For example, you may want to process part of a string where the offset and length depend on the contents of the field. You could use field symbols in this case. However, since the MOVE statement also supports variable offset and length specifications, you should use it instead. The MOVE statement (with your own auxiliary variables if required) is much safer than using field symbols, since it cannot address memory beyond the boundary of a field. However, field symbols may improve performance in some cases.
    check the below links u will get the answers for your questions
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/content.htm
    http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/field_sy.htm
    http://searchsap.techtarget.com/tip/1,289483,sid21_gci920484,00.html
    Syntax Diagram
    FIELD-SYMBOLS
    Basic form
    FIELD-SYMBOLS <fs>.
    Extras:
    1. ... TYPE type
    2. ... TYPE REF TO cif
    3. ... TYPE REF TO DATA
    4. ... TYPE LINE OF type
    5. ... LIKE s
    6. ... LIKE LINE OF s
    7. ... TYPE tabkind
    8. ... STRUCTURE s DEFAULT wa
    The syntax check performed in an ABAP Objects context is stricter than in other ABAP areas. See Cannot Use Untyped Field Symbols ad Cannot Use Field Symbols as Components of Classes.
    Effect
    This statement declares a symbolic field called <fs>. At runtime, you can assign a concrete field to the field symbol using ASSIGN. All operations performed with the field symbol then directly affect the field assigned to it.
    You can only use one of the additions.
    Example
    Output aircraft type from the table SFLIGHT using a field symbol:
    FIELD-SYMBOLS <PT> TYPE ANY.
    DATA SFLIGHT_WA TYPE SFLIGHT.
    ASSIGN SFLIGHT_WA-PLANETYPE TO <PT>.
    WRITE <PT>.
    Addition 1
    ... TYPE type
    Addition 2
    ... TYPE REF TO cif
    Addition 3
    ... TYPE REF TO DATA
    Addition 4
    ... TYPE LINE OF type
    Addition 5
    ... LIKE s
    Addition 6
    ... LIKE LINE OF s
    Addition 7
    ... TYPE tabkind
    Effect
    You can define the type of the field symbol using additions 2 to 7 (just as you can for FORM parameters (compare Defining the Type of Subroutine Parameters). When you use the ASSIGN statement, the system carries out the same type checks as for USING parameters of FORMs.
    This addition is not allowed in an ABAP Objects context. See Cannot Use Obsolete Casting for FIELD SYMBOLS.
    In some cases, the syntax rules that apply to Unicode programs are different than those for non-Unicode programs. See Defining Types Using STRUCTURE.
    Effect
    Assigns any (internal) field string or structure to the field symbol from the ABAP Dictionary (s). All fields of the structure can be addressed by name: <fs>-fieldname. The structured field symbol points initially to the work area wa specified after DEFAULT.
    The work area wa must be at least as long as the structure s. If s contains fields of the type I or F, wa should have the structure s or at least begin in that way, since otherwise alignment problems may occur.
    Example
    Address components of the flight bookings table SBOOK using a field symbol:
    DATA SBOOK_WA LIKE SBOOK.
    FIELD-SYMBOLS <SB> STRUCTURE SBOOK
    DEFAULT SBOOK_WA.
    WRITE: <SB>-BOOKID, <SB>-FLDATE.
    Regards
    ANJI

  • Dynamic IF condition

    Hi Forum!
    I want to know if it's possible to build a dynamic logical expression for IF or CASE instructions and get it evaluated.
    For example:
    data: LogExp type string.
    LogExp = 'Sy-subrc eq 0'.
    IF (LogExp).
    Endif.
    Or
    data: Var type string,
          LogExp type i.
    LogExp1 = 0.
    LogExp2 = 4.
    Var = 'Sy-subrc'.
    Case (Var).
      When (LogExp1).
      When (LogExp2).
      When others.
    Endcase.
    Thanks in advance.
    John.

    Hi John,
    in general your idea of dynamic logical expression is not possible in ABAP.
    But you can use the operator IN in combination with range tables. You have define all variables in your statement. Empty range tables will be treated as true.
    See this example:
    data lt_r_subrc type range of sy-subrc.
    data ls_r_subrc like line of lt_r_subrc.
    ls_r_subrc-sign = 'I'.
    ls_r_subrc-option = 'EQ'.
    ls_r_subrc-low  = 0.
    insert ls_r_subrc into table lt_r_subrc.
    if sy-subrc in lt_r_subrc.
    " do something
    endif.
    Just modify the range tables for different conditons.
    Regards,
    Axel

  • InfoSpoke Destination.

    Hi Gurus
    InfoSpoke Destination.
    I have a problem with the InfoSpoke Destination. I need to change the statical path to dynamic path, so I can transport the path without altering the path after the import to Q and P.
    Currently I am using File Name as destination. So I have created a logical path and logical file. I have changed the destination to Logical File Name and assigned the logical file as the infospoke destination. This works fine.
    Now I need to implement this solution to 50+ InfoSpokes and the catch here is: I have to create for each InfoSpoke one Logical File (50+ entries)
    I have tried the available parameters in the Logical File creation, but InfoSpoke ignores them.
    Does any one know a way how to make dynamical Logical Files please?
    In case you use the FM as the return value, could please post the source code?
    Thanks in advance
    Martin

    Hi Martin,
    Logical File path is one time activity and u can assign all of ur Logical File names to it.. in FILE transaction..
    As Logical File name belongs to individual Infospokes, u need to create the new Logical Files names individually for each one. and assign it with the Path.
    I dont think that u have other option to proceed for creating the Logical File names for all 50+ Infospokes.. dynamically.. U have to create them manually.
    And then transport them to the next level systems with overwrite mode along with the infopokes(which is with the Logical File names instead of the File name).
    Thanks
    Hope this helps

Maybe you are looking for