Beginner's concatenation + field populate - InfoPath Dev
in

InfoPath Dev

Beginner's concatenation + field populate

Last post 04-11-2012 01:46 AM by joemacangel. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 04-10-2012 06:39 AM

    Beginner's concatenation + field populate

    First, let me thank you for an awesome community.  You guys can seriously do some infopath ninjutsu, so for the remainder of my deployment I'm going to be visiting you guys daily.

    I'm an Air Force programmer, but I haven't had the opportunity to use sharepoint much, that's a different career field most of the time. However, with deployments you kinda do whatever is needed, and they needed a sharepoint genius...I'll get there slowly, hopefully.

    First question of the day is if I have a control number I'd like to add to the form, basically a concatenation of last name, first name, last 4 social security number, and nothing I'm trying is populating a field with that number.  I'm getting the hang of rules and stuff like that in infopath, but I cannot get the field to populate.  Am I missing something?  My current rules are pretty simple things, "If [field] isn't empty (I hate negative logic, but infopath doesn't give me much to work with in that regard), so once the required fields are empty the control number should populate, right?

    I'm sure I'm missing something.  Can anyone shine a light?

    Thanks,

    Joe

  • 04-10-2012 08:38 AM In reply to

    Re: Beginner's concatenation + field populate

    Hi, and welcome.

    Here's what I struggled with when I started with InfoPath - rules only execute when the field they are set on changes. So, let's say you have a rule set on fieldA, and it is meant to set fieldB - the rule only runs when fieldA's value changes.

    Default values, on the other hand, update on their own, using whatever the current value of the fields used in the formula are - at least as long as the checkbox in the field's properties that says something about updating if fields changed is selected.

    So, more directly, to your problem- I'm confused by this "...once the required fields are empty the control number should populate" - seems to me you'd want the required fields to have values to populate the control number.

    It seems in this case a default value may be more appropriate than a rule - in the data source task pane, you can right click your control number field, and in the properties dialog, you can use a formula (click the fx button) and create your concat statement.

    Does that make sense? Let me know if you need more info, and thank you for your service.

    Hilary Stoupa

  • 04-10-2012 08:38 AM In reply to

    Re: Beginner's concatenation + field populate

    Hi there, and thanks for the great comments!

    Action rules will trigger typically on two types of events: button clicks and field changes.  So if neither of those two things are happening, the rule won't run even if its already in the state where [field] isn't empty.  I'm not exactly sure what your scenario is, but perhaps you can try just setting a default value on the field you are trying to set?   Maybe there is a different way you can write the rule so that it triggers properly.  Perhaps if you explain a little more what you are trying to do I can help with how to build your rule.

    Anson Hidajat
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™

  • 04-10-2012 09:05 AM In reply to

    Re: Beginner's concatenation + field populate

    Wow, thanks again for the insight!

    A default value worked quite well.  I'd like to do a little bit more with the concat() statement though.  How about adding a datestamp to it?

     Right now on the "LEAVE CONTROL NUMBER" fieldI have a default value of

    concat(SERVICE, LASTNAME, LAST4SSN)

     And it populates itself as each of those fields get info entered in.  Any idea on how to get a datestamp appended on the end?  Timestamp is a bit too much, but today() would be good if i could format it something like 20120410.

     Trying to get the Leave Control Number to say something like USAFSMITH123420100410.  That would be perfect.

  • 04-10-2012 09:34 AM In reply to

    Re: Beginner's concatenation + field populate

    Formatting dates inside formulas is a little tricky.  There are a few options you can take:

    • msxsl:format-date() will work, but only in filler forms
    • You can parse the date out yourself using string functions.  Since your date format looks pretty simple, this is quite possible to do in formulas.
    • qRules offers a format date function that you can use without writing custom code: http://www.qdabra.com/en/products/qRules_new.aspx

    Hope one of those options will work for you!

    Anson Hidajat
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™

  • 04-10-2012 09:36 AM In reply to

    Re: Beginner's concatenation + field populate

    You could use today() + translate to remove the "-" chars.

    concat(SERVICE, LASTNAME, LAST4SSN, translate(today(), "-", ""))

    Hilary Stoupa

  • 04-11-2012 01:46 AM In reply to

    Re: Beginner's concatenation + field populate

    Thanks for the help guys, this is great info.

    I'm going to start another thread now.  I've got a different question...

    Thanks again!

    Joe

Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.