Splitting a string - InfoPath Dev
in

InfoPath Dev

Splitting a string

Last post 11-30-2016 11:52 AM by Tom. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 11-29-2016 08:37 AM

    • Tom
    • Not Ranked
      Male
    • Joined on 03-14-2016
    • USA
    • Posts 13

    Splitting a string

    I have a field in a table that stores a string of history values for my entries which is always the same length per new entry, for example: I want to write some code to look at these values and pull the last 3 characters based on the date. For example, if the user is looking at month 10, I want the "100" but if looking at month 11, I want the "111". Is there any way anyone knows of that this can be done?
  • 11-29-2016 02:01 PM In reply to

     So - your table is in your main or a secondary data source? I guess I'm having a hard time understanding what you are trying to do, but it seems like you may not even need code for this ... might be able to just use XPath. Can you maybe attach a screenshot under the Options tab in a reply that describes this a bit more thoroughly?

    Hilary Stoupa

  • 11-30-2016 05:46 AM In reply to

    • Tom
    • Not Ranked
      Male
    • Joined on 03-14-2016
    • USA
    • Posts 13
    Hi Hilary, I am looking for an XPath solution. essentially I have a secondary data source for which a single field contains a history of what was entered for example at different times: I have the secondary data source as a repeating table and outside of that table I have a date value that I can select. I want to be able to for example select the date "2016-11-15" and return "XYZ" as this was the value that was applicable on that date ("XXX" isn't applicable until "2016-11-20" for example). Does this make sense?
  • 11-30-2016 07:58 AM In reply to

     Yah - what does the data in the secondary table look like? Just date values? Are you looking for an exact match - user selects 2016-11-15 and you want back just the last three digits from another field in a row that has 2016-11-15? At any rate, I created a simple sample - save the attached file locally, right click and select Design, then you can preview. If the data is a fixed length, you should just be able to use a substring formula. If it varies, the formula will be slightly more complex. If the date is an exact match, you can just use a filter to get the right row - if it is a range, that gets more complex (again) - but hopefully this will help?

    Hilary Stoupa

  • 11-30-2016 11:52 AM In reply to

    • Tom
    • Not Ranked
      Male
    • Joined on 03-14-2016
    • USA
    • Posts 13
    Thanks! It will take me a few days to try this so let me give it a go and see how it goes. I will let you know.
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.