Jump to content

Extend function, the unknown one


This topic is 6503 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi all friends

there are some unespected things coming from this function.

(I found this when try to set all the rep to the control value)

For example I have 2 fields:

control - number field

repeating - calculation repeating field with 10 rep and calc:

Case(

IsEmpty(control);Extend(control);

repeating

)

Now i think that if control is empty, repeating is empty too...but if I enter something into "control", "repeating" Extends... :

If you change the calc to UNSTORED, there are some other unespected things... (the first rep comes with "?" and the remaining reps...)

And so the same, if you change the calculation to number with option of autoenter a calc (the same) The first rep of the repeating blanks, but the other reps will be empty only if edited ;)

Who knows the WHY ?

Link to comment
Share on other sites

Try using IsEmpty(Extend(control)) or IsEmpty(control[1]) for your test. If you do not extend or specify the repetition in the test, then only the first repetition can ever return a true result. A repeating calculation automatically assumes that any fields involved reference their nth repetition, where n is the current repetition, unless otherwise specified. Since control only has one repetition, any tests with it beyond the first repetition have no meaning.

Link to comment
Share on other sites

It seems to me the Extend function is designed to use a non-repeating field in conjuction with every rep of a repeating field to calculate the repititions in a seperate repeating field, as in attached example. I think the strange behavior you are seeing is because you are not specifying what repeating field you want to extend the non-repeating field against.

What exactly do you want to accomplish?

Extend_Something.zip

Link to comment
Share on other sites

Hi sbg2

"In the third example "repeating" is a text field AutoEnter/Replace...that was the way I started to look."

That was the way I started to make the repeating field containing "control" into all the repetitions...but only if control IsEmpty.

So the repeating field (AutoEnter, not calculation) can be edited and, at wish, cleared flagging "control" with ""

Now you have changed it to a calculation repeating field and can be setted to "0" if "control" is empty... but reverse it to AutoEnter and it no more works.

Link to comment
Share on other sites

Again, enclose each test with Extend( ) and I believe the results are as expected. Without Extend( ), the tests make no sense beyond the first repetition and so any results may be completely unexpected. As FM Help states: "Without the Extend function, the value in non-repeatingField is used only with the first repetition in the repeating field."

The second one, however, I am surprised returns a result at all. I would think it should send FM into an infinite loop and force one to crash the program. Luckily it only returns a question mark. An unstored calculation which references itself does not sound like a good idea at all, imo.

Regarding the auto-entered calculation, I believe you would need to use a lookup to a repeating field with no values in any repetition. I do not believe an auto-enter is designed to work this way for repeating fields, though I could be mistaken.

Link to comment
Share on other sites

Regarding the auto-entered calculation, I believe you would need to use a lookup to a repeating field with no values in any repetition. I do not believe an auto-enter is designed to work this way for repeating fields, though I could be mistaken.

Again thank you, Queue.

I know that it can be made with a lookup...

but I'm always searching new ways !

But try this one:

make a repeating field with 10 rep, text with AutoEnter/replace option of:

1) data = 1

2) calc: extend(repeating)

all the rep will be filled with 1s

Now the even better:

the same field with:

1) serial

2) calc: extend(repeating)

LOL :)

Link to comment
Share on other sites

make a repeating field with 10 rep, text with AutoEnter/replace option of:

1) data = 1

2) calc: extend(repeating)

all the rep will be filled with 1s

Are you referring to two repeating fields here, both with auto-enter options, or is the first field a normal text field and the second repeating?

Link to comment
Share on other sites

  • 2 months later...

This topic is 6503 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.