Expand my Community achievements bar.

SOLVED

"if (paginated . . .)"

Avatar

Former Community Member

I need to figure out how to make the rawValue of a textfield in a table header change when that header is repeated on the next page.  I have a table where multiple instances of a row can be added, and it could cause a page break.  When this happens, I want to take some information the user will have already entered and change the value of the textfield to that.  untitled_2 shows what the first few instances should look like, and untitled_3 shows what I want to show up as the header after a page break (notice the date is the same-that's the information the user enters that I want to transfer to subsequent pages).  I'm thinking the script will be in the initialize or layout::ready event and will look something like

if (this is the initial header) {

     this.rawValue = "Date";

}

else {

     this.rawValue = Body.Date.rawValue;

}

I just can't figure out what should be in the parentheses of the if statement.  Anyone have any ideas?

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Interesting ......The cell that holds the titke is a static Text field and that has no events to program against. So I woudl remove the static text from that cell, then add a regular Text Field to the Cell. Make the field protected, so the user cannot type into it. Set a default value to the name that you want to give the column  - "Date". Now you have events that you can program against. On the Doc Ready event use this code:

if

(xfa.layout.page(this) == 2){

     this.rawValue

= DateFieldName.rawValue

}

If the field is on the 2nd page then the value of the column header will change to the value of the DateFieldName field.

Paul

View solution in original post

4 Replies

Avatar

Correct answer by
Former Community Member

Interesting ......The cell that holds the titke is a static Text field and that has no events to program against. So I woudl remove the static text from that cell, then add a regular Text Field to the Cell. Make the field protected, so the user cannot type into it. Set a default value to the name that you want to give the column  - "Date". Now you have events that you can program against. On the Doc Ready event use this code:

if

(xfa.layout.page(this) == 2){

     this.rawValue

= DateFieldName.rawValue

}

If the field is on the 2nd page then the value of the column header will change to the value of the DateFieldName field.

Paul

Avatar

Former Community Member

Thanks Paul!  I was able to adapt your suggestion, and I have the basics figured out.  Quick questions-I'd like to format the date that comes out on the second page the same way I have it formatted in DateFieldName rather than the default way, which is YYYY-MM-DD, but when I try to use the picture code date{M/D/YYYY} it gives me an error, because I'm trying to use a date picture code in a text field.  How do I work around this?  Second, when I first tried this I set the text field's access to "readOnly", then, incorrectly thinking that was causing my problems, changed it to "protected".  They seem to work the same, so what's the difference between the two?  I can't find any explanation of it in Designer Help.

Avatar

Former Community Member

For the 1st problem make it a Date field amd your picture clause will work.

For the 2nd - If you do a serach for readOnly in the Help it explains in the access property what all of th eoptions mean. Basically, th euser can copy and paste a value from a readOnly field but they cannot from a protected field.

Paul

Avatar

Former Community Member

Thanks!  At first I didn't think making it a Date/Time Field would work because I didn't think you could put anything but dates and times in it, but I guess you can use it like a regular text field!  Of course, it yells at you because your text can't be formatted like a date the way the picture code is telling it to, but that's a small price to pay.

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----