Link to home
Start Free TrialLog in
Avatar of notesrookie
notesrookieFlag for United States of America

asked on

Best way to collect data to show in 2 rows for each document in a view

Greetings most learned colleagues,

I'm trying to figure out how to most efficiently display values from 2 fields on the same form in the same line in a view and clear information after a particular procedure is run. I know that I should probably read the information into an array. Can I do that on the form?

Currently I have:
Form
Field1a: number, editable, Field2a: number, editable, ... Field12a: number, editable
Field1b: number, editable, Field2b: number, editable, ... Field12b: number, editable
FieldV1: text, computed, holds field1a:field1b values, ... FieldV12: FieldV1: text, computed, holds field12a:field12b values

The columns holding each of the FieldV1, ... FieldV12, has the multi-value separator as New Line.

As part of running the procedure, I clear the FieldV1, ... FieldV12 by referencing each of them (laborious copy and paste and change but doable). Is there a better way to do this as I have a bunch of these fields that I will need to clear? Like using @For (I read the help but can't get a handle on it)?

Thank you so very much.

Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

I've read your post twice, and it's still Klingon to me...

> ... values from 2 fields ...
You mention 36 fields, and I suppose there are a lot more.

> ... particular procedure ...
??? Would some code be useful?

> ... columns holding ...
You're talking view all of a sudden, I suppose you have 12 columns?

> ... a bunch of fields that ... to clear ...
??? Why

Can you give us:
- a more detailed/exact specification of what you want
- if possible in user terms, e.g. describing the final output
- separate stories for form and view
- input/process/output for the "particular" procedure

There might be better ways to do this than to use a @For. @For that, we need to know @More ;)

Qapla'
Avatar of notesrookie

ASKER

Sjef - Yes there are at least 3 sets of 12 (related to the months of the year), the procedure copies the current year's data (1st set of 12), say 2005, to previous year's data (2nd set of 12) and overwrites what was there previously and clear the surrent year's fields. I mention the view because the 3rd set of 12 is computed to show up in the view. When the procedure is run and even with a view refresh, it still shows the data from 2005 even though the current year's fields are now empty, having been cleared after being copied to previous year. The data still remains in the fields used to compute the values for the view. So I'd like to clear them so as not to confuse the user. But it looks like I'm also confusing you. I can go home now, my job is done! :D I hope this helps calrify my situation. Thank you.
Sorry - I meant to say "clarify". My logic behind creating the 3rd set of 12 was to have the calculations done in the form instead of the view. I don't speak Klingon - qapla'? It's Greek to me :D Efharisto poli
> ... I hope this helps calrify my situation...
Oh, it does, but just a little. Most of my questions are still open, and you're not getting away (with this) so easily! I should have asked for an example, what do you want to see in the form and what in the view.

Let me put myself in assume-mode, translating your description as far as I can get what you're after:

1) about your Form F
- it contains 2 sets of editable fields f1a..f12a and f1b...f12b
- there's a 3rd set of computed fields fv1..fv12, with the combined values (as text list)
    f1:    123  124  125  ....
    f2:    140  144  140  ....
    fV:    "123":"140"  "124":"144"  "125":"140"  ...

2) you have a view V
- with 12 columns that display the values fV, on separate lines

3) there is a procedure P
- when does it work, how is it activated? (agent, button, or something else??)

Why are 2 sets editable, and not only one?
Show multiple values as separate entries is set in the 12 similar columns of the view?
I'd love to see the code of your procedure!

Ah, I think I understand your problem. You run an agent on a document, you set values in a document and you assume the document's values are recalculated? Alas, they are not, you have to do that in the agent.
sjef - Good assumptions on your part and here is some further explanation on mine

>> 3) there is a procedure P
      - when does it work, how is it activated? (agent, button, or something else??)

Procedure P is a view action button that calls an agent to do it's thing, that is, for example, let's say that the data currently in the document is from 2003. At year end, after the data has been locked to prevent any further updates, the agent copies the contents of the 12 months of 2003 to a section that contains 12 computed fields. This section is now holds the data from 2003, the current year's data is set to blanks and the data is unlocked. Now each year's data will contain 2 sets of 12 months because the customer wishes to capture data from 2 situations, passed the test and did not pass the test.

>> Why are 2 sets editable, and not only one?

Please see above paragraph.

>> Show multiple values as separate entries is set in the 12 similar columns of the view?

Your assumption 1) is correct. I use new line multi-value separation for each month's column and it is built from the FV fields so that each document will show
     SomeProduct
          Pass             1     2     3     ...     6
          Did not pass  0     1     1     ...     2
     AnotherProduct
          Pass             5     7     9     ...     8
          Did not pass  3     3     4     ...     3

>> I'd love to see the code of your procedure!

If you still want to see it after my latest explanation, please let me know and I'll upload the clunky code. I'm hoping to be able to have more elegant code.
ASKER CERTIFIED SOLUTION
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
sjef - you hit it on the nose!  The real question was how to access the values in the sets of 12 fields without having to type each one out, it's laborious even when cutting and pasting. They all have pretty much the same name just the last bit is different based on the month. I was looking for a construct (but was, obviously, at a loss for words) and I see that you have provided me with much more elegant script that I will test. I be back .... Thank you.
That was just tremendous! I implemented your suggested code and saved not having to write out or copy and paste a a bunch of lines. No cramped fingers :). Thank you, thank you.
Welcome! Welcome! Welcome! (That was a copy/paste action... ;)