none
How to empty a node based on the value of an element?

    Question

  • Hi all,
    How to empty a node based on the value of an element?(Based on conditions).
    For eg if element is present node should exist,else node should be empty.

    Consider
    For eg:

    E,F,Z, Y,X,L, P
    A,B,C,D,E,F,G
    A,B, ,D,E,F,G

    Here node 3 should be empty.But in my case when i am using value Mapping functoid when C is empty it creating a node without C,what i need is node should also be empty?


    Thanks

    Tuesday, November 26, 2013 10:23 AM

Answers

  • Then use Equal Functiod:

    “based on some calculations C is found” -  I assume you do this calculation in scripting function or any other functiod which drives you the result that C is found or not.

    Link that scripting functiod (or the funtiod which drives you the result that C is found or not) to equal funtiod. And set the second parameter to C. i.e if first parameter is equal to second parameter-C, link the Equal funtiod to The whole node (where you have A,B,C,D,E,F,G)

    Using Equal Functiod, you can supress/have the whole node constructed in map.


    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful.

    • Marked as answer by Nitish24 Monday, December 02, 2013 6:10 AM
    Tuesday, November 26, 2013 11:36 AM

All replies

  • You need to do value mapping ONLY if Node Exists is what you want and in your case C is not EMPTY is has " " so that is what the value mapping maps across.

    even if the Data is A,B,,D,E,F,G - the Flat File Disassembler will create an empty node C <node_C /> so the Exists Functoid will still return true. You may want to add a condition checking is <node_C /> is NOT empty then value mapping.

    Regards.

    Tuesday, November 26, 2013 10:33 AM
  • To suppress empty tags, use the Value Mapping functoid to control if a tag gets created or not.

    • connect the element in question to a LOGICAL EXISTENCE functoid
    • Connect the LOGICAL EXISTENCE functoid to a LOGICAL AND functoid
    • Connect the element in question to a NOT EQUALS functoid
    • In the NOT EQUALS functoid, set the Condition2 to Empty (do set to anything, just create constant with empty value)
    • Connect the NOT EQUALS FUNCTOID to the LOGICAL AND functoid
    • Connect the LOGICAL AND functoid to the VALUE MAP functoid.
    • Connect the VALUE MAP functoid to the destination element.


    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful.



    Tuesday, November 26, 2013 10:33 AM
  • Hi,

    the problem what i am facing is that if Element C is empty the whole node A,B, ,D,E,F,G should not exists.

    My input is P,Q,R,S,T,U,V, for this input based on some calculations C is found if C is present the node A,B,C,D,E,F,G should exists else the whole node(A,B,C,D,E,F,G) should not exists.

    Thanks

    Tuesday, November 26, 2013 11:21 AM
  • Then use Equal Functiod:

    “based on some calculations C is found” -  I assume you do this calculation in scripting function or any other functiod which drives you the result that C is found or not.

    Link that scripting functiod (or the funtiod which drives you the result that C is found or not) to equal funtiod. And set the second parameter to C. i.e if first parameter is equal to second parameter-C, link the Equal funtiod to The whole node (where you have A,B,C,D,E,F,G)

    Using Equal Functiod, you can supress/have the whole node constructed in map.


    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful.

    • Marked as answer by Nitish24 Monday, December 02, 2013 6:10 AM
    Tuesday, November 26, 2013 11:36 AM
  • Hi Nitish

    Kindly paste the pic of what the input and output schema should looks like.

    Regards

    Wonder Hlongwane


    Wonder Andile Hlongwane MCTS

    Tuesday, November 26, 2013 11:47 AM
  • You should be able to set the "Suppress Empty Nodes" schema property to "Yes", set the pad character to " " and use "Logical Existence" and "Value Mapping" functoids in your map to accomplish your requirement.


    David Downing... If this answers your question, please Mark as the Answer. If this post is helpful, please vote as helpful.


    Tuesday, November 26, 2013 4:29 PM
  • Hi,

    If you want to suppress complete record on the basis of some condition then use a combination of Equal and Not functoid.

    here in equal functoid give null(by simply clicking on Insert new parameter and not giving any value) and passing its ouput to NOT functoid.

    This will ensure population of Output record only if input record exists else it will suppress whole record.

    Benefit of this idea over using exists functoid is - Exists functoid gives true for <LastName />(Empty tag) while equal functoid placement returns false.

    Let us know if you face any issue.

    Thanks.


    Thanks,
    Prashant
    ----------------------------------------
    Please mark this post accordingly if it answers your query or is helpful.

    • Proposed as answer by PRASHANT.1704 Wednesday, November 27, 2013 10:34 AM
    Wednesday, November 27, 2013 10:33 AM