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.  How to get data from a field in terms of its array location

    Employee
    Posted 10-15-2015 01:22

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

    Originally posted by: Priyanka Samad

    My scenario is, when i receive the input file, i am not sure what all fields will have data in them, most of them are null. From these, i have to pick the ones that have dates in it and have to format it from YYYY-MM-DD to MMDDYYYY. So far i am able to pick the columns having dates in it,, further to apply formats,, i was wondering if we have any funtion that could help in reading the column names ,like inputfields(),, i am not sure how to code this.

    Thanks in advance for the help


  • 2.  RE: How to get data from a field in terms of its array location

    Employee
    Posted 10-15-2015 05:35

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

    Originally posted by: ryeh

    So there is a function like you said - inputFields() - that will return a list of all the fields. You could write a while loop to go through the list and then format it if it's a date format, but the problem is that you won't be able to emit the new values with the original names. That is, when you write:
    emit someFunction as "Name1"
    "Name1" can not be dynamically assigned.

    How many records are you looking at? I can think of a way for small-ish (say <1M) sets, but not ideal for super large volumes.


  • 3.  RE: How to get data from a field in terms of its array location

    Employee
    Posted 10-16-2015 02:00

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

    Originally posted by: Priyanka Samad

    Hi Ryeh

    Thanks for helping me in this .
    The number of records will be around 1000 or even less than that. Please let know if there is any other simpler way to do this.


  • 4.  RE: How to get data from a field in terms of its array location

    Employee
    Posted 10-16-2015 06:04

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

    Originally posted by: ryeh

    See attached for a quick stab at this problem. As previously mentioned, you could write a while loop to go through the list, check to see if it's a date format, and if so, output the value and the fieldname (using 'inputFields' function). That would essentially replace the Change Metadata, Add Prefix, and Pivot nodes. You would still need to undo the pivot, i.e. the last pivot.
    Attachments:
    PivotExample.brg


  • 5.  RE: How to get data from a field in terms of its array location

    Employee
    Posted 10-27-2015 07:20

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

    Originally posted by: Priyanka Samad

    I was out for a week. Just saw the graph.
    Thanks a lot Ryeh !! this works !!