I actually figured this out, but need some other related help if anyone would be so kind. It truns out that Go To Next Field goes in tab order. If you reach a field in a layout that dead ends at a tab it appears you do not iterate to the next field even if there are more fieds. Does anyone know a way around this?
Try in this way:
Go to Layout
Go to first field
set variable $firstField as active field
do work on active field
go to next field
exit loop if $firstField = active field
strngr12 ha scritto:
it truns out that Go To Next Field goes in tab order.
Yes, and if there aren't fields in the tab order, the script will stop at the first field.
The solution ? Use a layout with all the needed fields staying in the tab order.
Thanks for your help. Unfortunately I'm writting a script for a client file that I don't have any control over. My loop works fine, I only have a problem getting to the next field if there's no tab to it.
And of course - tab order or not - you cannot use the go next field script step to go to a calc field.
There is another way to do it, but not GOING to the field..., SETTING:
Set error Capture [ On ]
Go to Layout [ "layout" ]
Set Variable [ $fieldNames ; Value:FieldNames ( Get ( FileName ) ; Get ( LayoutName ) ) ]
Set Field By Name [ Let( $i = $i + 1 ; Get ( LayoutTableName ) & "::" & GetValue ( $fieldNames ; $i ) ) ; " Your Calc Here" ]
Exit Loop If [ $i ≥ ValueCount ( $fieldNames ) ]
Thanks! I can see how that is supposed tp work, but I can't get it to return anything.
What I'm trying to do is turn a fieldname and value into:
And the append it to a document. Do you know how I can do that using the above?
Start with the beginning of Raybaudi's script.
Go to Layout [ “Util - View as List Contacts” (Contacts) ] Set Variable [ $fieldnames; Value:FieldNames ( Get ( FileName ); Get ( LayoutName ) ) ] Set Variable [ $$document; Value:"" ] Set Variable [ $loopend; Value:ValueCount($fieldnames) ] Set Variable [ $cnt; Value:1 ] Loop
Set Variable [ $field; Value:GetValue($fieldnames;$cnt) ]
Set Variable [ $value; Value:GetField($field) ]
Set Variable [ $$document; Value:Let( $txt = "<attribute=" & $field & ">" & $value & "<attribute>"; List($$document; $txt)) ]
Exit Loop If [ Let( $cnt = $cnt + 1; $cnt > $loopend ) ]
When the loop completes the global variable will have a complete list of fieldnames and values.
This part of the set variable for $$document builds the string you need.
$txt = "<attribute=" & $field & ">" & $value & "<attribute>"
You will have to play with this a bit to properly put in the " characters.
You can set up a layout to display the $$document as a merge variable and print it to a pdf or copy and paste.
Your format looks very similar to xml, could you set up a style sheet and just export the data directly as xml?
Thanks so much!