May 22, 20178 yr I'm stuck in my thinking.... How would I go about evaluating (getting the content) of multiple fields specified as merge fields in a text field? For example: "Name: " & <<Name>> & ", " & "Category: " & <<Category>> & ¶ & "Type: " & <<Type>> Which would result in: "Title: MyRecordName, Category: MyCateogry MyType" Any input most appreciated! Edited May 22, 20178 yr by artvault
May 22, 20178 yr "Name: " & Table::Name & ", " & "Category: " & Table::Category & ¶ & "Type: " & Table::Type Table being whatever table the field is coming from or if it's in an auto enter calculation where the text field is in the same table "Name: " & Name & ", " & "Category: " & Category & ¶ & "Type: " & Type
May 22, 20178 yr I am afraid you are confusing two different techniques. The term "merge fields" is used for fields you place inside a text block on a layout - not in the context of a calculation. In your example, you would simply type the following directly onto the layout: Name: <<Name>>, Category: <<Category>> Type: <<Type>> If for some reason you need the same result within a calculation field, use the following formula = "Name: " & Name & ", Category: " & Category & "¶Type: " & Type Edited May 22, 20178 yr by comment
May 22, 20178 yr Author Thank you so much for your replies! I should have explained the context better, my apologies. I would like users to be able to enter a combination of descriptive text and field names into one single text field, combined with commas and line breaks. I would then want use a calculation/script step that evaluates all of the content of the text field and "pulls-in" information from the referenced fields (hence my usage of the term merge fields, which I realize was not accurate). The syntax of the text field is flexible, what ever works best. I know I can use Evaluate () but I'm not sure how I have to structure this for it to handle multiple fields and "plain text" content. For example, let's assume that users would type into a text field: "Name: " & Name & ", Category: " & Category & "¶Type: " & Type How would I evaluate/process this altogether? As a chunk? Edited May 22, 20178 yr by artvault
May 22, 20178 yr 17 minutes ago, artvault said: For example, let's assume that users would type into a text field: "Name: " & Name & ", Category: " & Category & "¶Type: " & Type How would I evaluate/process this altogether? If you had a user smart enough to type exactly that into a text field, then Evaluate ( YourTextField ) would produce the expected result. There are other options, depending on what your users may find convenient. For example, they could type the text as text, not as a calculation formula, and merge the fields inside the text - the same way you would, if placing the text on a layout (as shown in my first example). Then you would use a recursive custom function (or a looping script) to find the merged fields and replace them with the corresponding values. Or, if the list of fields they can use is limited and known in advance, use the Substitute() function to do the "merging". Edited May 22, 20178 yr by comment
May 22, 20178 yr Author Ha! Now it works! I had a typo in the text I typed, which resulted in a "?" - which proves your point exactly: if I can't trust myself, how can I trust my users to type correctly... I will look into a recursive custom function, as there are quite a lot of fields to choose from. Thanks again for pointing me in the right direction!
Create an account or sign in to comment