LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  Problem with nested IF in filter node

    Employee
    Posted 10-31-2013 01:23

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: epetrou

    Hello,


    Ive been trying to do a nested if formula but it isnt working properly,although i dont get a error..It just doesnt seem to go in the third if in the nested IFs..i cant seem to spot any problem with the code..my bet is ,that theres something wrong with the format of my columns in the file.. Sample file attached in the post.

    What im trying to do is create a final column based on the data of 4 other columns. For example if the first column is not blank i copy the non-blank data in the final one, the blank data of column1 and the non blank data from column 2 copied into the final column and so on.

    There is a possibility that more than 1 column could have data, but i only want to keep the data in the order i put them inside the if function. Here is the code ( i also change the format of these 4 columns to string as it wasnt working as unicode)

    tmp1_str=madness_tmp1.str()
    tmp2_str=madness_tmp2.str()
    code_str=MADNESS_CODE.str()


    if Channel!="" then
    final_madness=Channel else
    if tmp1_str!="" then
    final_madness=tmp1_str else
    if tmp2_str!="" then
    final_madness=tmp2_str else
    if code_str!="" then
    final_madness=code_str else
    final_madness="NOT VF SHOPS/CORNERS_DOES NOT EXIST IN TARGET FILES"

    emit *,final_madness
    Attachments:
    query error.zip


  • 2.  RE: Problem with nested IF in filter node

    Employee
    Posted 11-01-2013 09:17

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Tim Meagher

    Hi,

    Is the attached spreadsheet the result after running your script, or the input to the script?
    Also, it looks like one of the problems might be that you have a lot of fields that are not null, but have their value set to the string "NULL" - which may be why you don't think this is working correctly....

    Tim.


  • 3.  RE: Problem with nested IF in filter node

    Employee
    Posted 11-01-2013 09:28

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Tim Meagher

    Also - I think the other issue that you might run into is that (null != "") will return true.

    So you probably need to change your code to:


    tmp1_str=madness_tmp1.str()
    tmp2_str=madness_tmp2.str()
    code_str=MADNESS_CODE.str()
    
    
    if Channel.isNotNull() and Channel!="" then
        final_madness=Channel 
    else if tmp1_str.isNotNull() and tmp1_str!="" then 
        final_madness=tmp1_str 
    else if tmp2_str.isNotNull() and tmp2_str!="" then 
        final_madness=tmp2_str 
    else if code_str.isNotNull() and code_str!="" then
        final_madness=code_str 
    else
        final_madness="NOT VF SHOPS/CORNERS_DOES NOT EXIST IN TARGET FILES"


  • 4.  RE: Problem with nested IF in filter node

    Employee
    Posted 11-04-2013 02:53

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: epetrou

    Thanx Tim it is now working as i want it !