Expand my Community achievements bar.

Question Macro

Avatar

Level 2

Hello,

I'm very new here and I don't know much about macros.

I have a question. I have a forms that contain 100+ text boxes, many of them preceded by a numbering (In a separate text object)   so

((1)  (blablablabla))

((2) (blablabla)) etc... (Where () represent an object/subform)

 

Sometime we insert a line between 2 other and... we need to manually changes all the numbering.

I was wondering if it was possible to have a macro that could do this job automatically

 

For example, something like "previous#+1" to all object that start with "ItemNumber_" in the hierarchy. Something like that would be so helpful.

 

I hope someone can help me with that.

 

Thank you.

 

6 Replies

Avatar

Employee

Assuming this is a AEM Forms Designer form

Kosta_Prokopiu1_0-1629288655843.png

If you have a dynamic table you an use the index of the parent (Row1) (0 based that is why I add 1)

When you add a line (here I add a t a fixed position) and use remerge the Numbers will recalculate.

Kosta_Prokopiu1_1-1629288788507.pngKosta_Prokopiu1_2-1629288846879.png

Kosta_Prokopiu1_3-1629288875729.png

 

 

Avatar

Level 2

Hello.

Thank you for your answer.

Actually, it's not a table, only simple text boxes within sub forms (a table is not an option unfortunately)

 

Thank yo again  

Avatar

Employee

tabels are just a fancy construct of subforms and fields you can do the same with subforms instances and fields inside the subform.

Avatar

Level 2

Ok, this is an example of what I'm trying to do.

the first 3 digits are normal text boxes and the 3 last are numerical.

What I intended to do (At the beginning), was to have a macro that populate the text field with the right number based on the previous one (So, following the hierarchy). All field that start with "ItemNumber_" would have been accounted for.

Why a macro ? just because this would have allowed us to see the number in the design view and also, update all numbers if we add a line in the middle of the page later.

If we could do that, I was even thinking about having the macro rename the second part of the field's name in the hierarchy (ex. ItemNumber_001, 002, 003, etc.)

 

That would be the best I can think but maybe I'm just in the dream land

 

The option you showed is also interesting but, it looks like the things is happening only when you click on "add line". In my situation, the final user doesn't have the ability to add anything. It's really to save time for the designer (and limited the error).

 

anyway thank you a lot for your help.

 

Asuryan37_0-1629302271534.png

 

Avatar

Employee

Hi @Asuryan37

What you show here is not a dynamic design but a static one. You want to see the number at Designtime not when rendered.
"Macros" as you call them do not exist at designtime. This is not Word To see the result you use the Preview and check against the rendered result.
My sample will als work with fixed design and fixed number of items, I just assumed you wanted the table to grow at runtime.

I have created forms and tables in many variations. XFA offers good dynamic features, especially data bound.
Will your cheesake table grow dynamically when data is merged with the design at render? Or are you creating XDPs specific for each "case"? BTW, this looks like a restaurant menu

Why do some items have 2 fields and some 3?

is itemNumber increasing from 1 (line number) or can there be individual numbers, menaing jums like 1, 2, 5, 6....?

Instead of individually design different items, name them all item so that you get individual items which still have an index.

I used the Duplicate function in Designer

Kosta_Prokopiu1_1-1629358784708.png

 

You can make item_input disappear by setting it to hidden if you do not want it in a line.

Preview:

Kosta_Prokopiu1_2-1629358806565.png

 

 

 

Avatar

Level 2

Hello.

 

Haha. Ya, I wanted to use a cake ipsum for change

I have a macro to put all objects on grid, a macro to reorder my tabbing order based on the hierarchy, so, I though it would be possible for a "one time a year" macro to populate a static text box with the right number (Previous +1). I do not intend to have that working dynamically since anyway, it's a static form. I just don't like the idea, each time I have to add a line, to manually add +1 on an hundred of object.

I added a field to illustrate that a table is not a good option. (Especially for accessibility purpose)

 

For the other question, yes, each time I put an "ItemNumber_" object, the last one the number inside should be +1.  The calcul is not dynamic (Actually, having a dynamic one would be a nightmare in my context)

 

Anyway, if it's not possible this way, it's ok. at least I tried

 

thank you again