Auto-populate Pre-determined Text if field is blank - InfoPath Dev
in

InfoPath Dev

Having trouble finding a blog or post that answers your question? Check out our Custom Search Page

Auto-populate Pre-determined Text if field is blank

Last post 01-02-2017 04:22 PM by Hilary Stoupa. 21 replies.
Page 1 of 2 (22 items) 1 2 Next >
Sort Posts: Previous Next
  • 12-21-2016 01:43 PM

    Auto-populate Pre-determined Text if field is blank

     Can I create a rule in InfoPath that says - after initiating query of SP list for Date of Last Inspection if the field is/remains blank then auto-populate Date of Inspection field with 'No Report Submitted'?

    Filed under:
  • 12-22-2016 02:47 PM In reply to

    Re: Auto-populate Pre-determined Text if field is blank

     Is this secondary data you are displaying on your form? If so, I'd use a calculated value that has the text in it - hide if the field is blank.

    Hilary Stoupa

  • 12-22-2016 06:21 PM In reply to

    Re: Auto-populate Pre-determined Text if field is blank

    Nope, not secondary data. Its a blank field, in which users should enter a status such as "No Deficiencies Noted". However, there's no assurance all users will enter the same data, as shown. Consequently, I've created a blank field, that I'd like auto-populated with the desired text when the checkbox is 'True'.
    Filed under:
  • 12-23-2016 07:17 AM In reply to

    Re: Auto-populate Pre-determined Text if field is blank

    Does the user check the box? If so, add the rule to the field bound to the checkbox.
    Hilary Stoupa

  • 12-23-2016 08:14 AM In reply to

    Re: Auto-populate Pre-determined Text if field is blank

    That was my first thought, but I was trying to add the rule to the results field, where the actual text would appear. But, I couldn't figure out a way. I'll try your recommendation.
    Filed under:
  • 12-23-2016 08:36 AM In reply to

    Re: Auto-populate Pre-determined Text if field is blank

    Rules fire when the field they are on changes. So you want the rule where the user (or form logic) takes an action / changes a value.
    Hilary Stoupa

  • 12-23-2016 09:00 AM In reply to

    Re: Auto-populate Pre-determined Text if field is blank

    ok, here's where I'm stuck; I've got my statement on the clipboard; when I try to create the rule on the checkbox I can't find the appropriate place to insert the text. When I try Action/Set Field Value/Value/Insert Function/Text...the system won't let me paste the text, it forces me to choose a field. What am I doing wrong?
    Filed under:
  • 12-23-2016 09:03 AM In reply to

    Re: Auto-populate Pre-determined Text if field is blank

    You don't want to Insert Function for the value, your text just goes in the value box. If you are in "insert function" you can put the text in quotes - that will make it a valid "formula".
    Hilary Stoupa

  • 12-23-2016 09:28 AM In reply to

    Re: Auto-populate Pre-determined Text if field is blank

    Tada! Like magic. As always, you're the best. Do you know anything about SP email workflows?
    Filed under:
  • 12-24-2016 08:40 AM In reply to

    Re: Auto-populate Pre-determined Text if field is blank

    This may sound like the same issue, but it's not. Can an InfoPath Date field be self-aware? I have a form that has a field called Date of Previous Inspection. The data for that field comes from a SP list column of the same name. The field, as well as several others, auto-populates (and it does work right now), whenever the user enters the building number in the form. The problem is not every building has been previously inspected; or, if it was a report has yet to be submitted. What I'm hoping, if after the building number has been entered and the form auto-populates there is no data in the Date of Previous Inspection field, a rule can fire that validates the field is empty and fill the field with 'No History of Previous Inspection'?
  • 12-25-2016 05:35 PM In reply to

    Re: Auto-populate Pre-determined Text if field is blank

    Sure. In the same rules you are using when the building number is entered, have the last rule check to see if the Date of Previous Inspection field is blank, and if it is, set the field's value. I wouldn't set a date field to text, myself - but if your date isn't actually a date, it should be fine. Or use another field.
    Hilary Stoupa

  • 12-26-2016 11:12 AM In reply to

    Re: Auto-populate Pre-determined Text if field is blank

    Worked like a charm. Now, can I do the same for a similar field in a repeating table? The table data is coming from a secondary connection, activated by the same building number entry process as the previous post.
    Filed under:
  • 12-26-2016 06:03 PM In reply to

    Re: Auto-populate Pre-determined Text if field is blank

    Hi Curtis,

    To get this technique to work in a repeating table requires an xpath that remembers the current() row that you are on (assuming you want to have a condition for the previous column).

    Let's say you have three columns and you want to condition the value for column two on column one. You would use the same kind of rule for the repeating field, but just prefix the field1 (column one) with current()/my:field1.

    Please let me know if that is enough to figure it out. If not, I can provide more details.

    Cheers!

    Patrick 

     

    Patrick Halstead
    Project Manager at Qdabra
  • 12-26-2016 07:42 PM In reply to

    Re: Auto-populate Pre-determined Text if field is blank

    I'm an InfoPath simpleton. Yes, I'll need you to provide more detail, please. Let's assume I'm a five year old; now, tell me how and where, again.
    Filed under:
  • 12-27-2016 05:22 AM In reply to

    Re: Auto-populate Pre-determined Text if field is blank

    The problem with the secondary data is when you query it, each row needs to be evaluated. The rule on the building number field would only work to set every single row to the same value - not what you want. Instead, "repurpose" another field in the secondary data connection. You are probably not using the ID field, right? So put a rule on the ID field to set the date (or whatever) field based on a condition.... then, on the building number, set ID (after querying the data source) to something it will never normally be, like 0. OR, just use calculated values and conditions to display either the value or the text.
    Hilary Stoupa

Page 1 of 2 (22 items) 1 2 Next >
Copyright © 2003-2017 Qdabra Software. All rights reserved.
View our Terms of Use.