Jump to content

Set Field - Target -> Repeating fields - How?


comcents
 Share

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

Recommended Posts

myField - repeating field - 5 repeats.

someField - same type field - no repeats.

loop - global field - number - no repeats.

In a script - when accessing data in a repeating field - I can get to it either by direct reference:

set field(someField, myField-2)

-or-

set field(someField, GetRepetition(myField,2)

-or-

set field(someField, GetRepetition(myField,myLoop).

I can SET Repeating field / repetition:

set field(myField-2,someField)

but how the heck do I:

set field(myField-loop, someField)????? Can you (I) not use a global to set which repeat in an assignment?

Here is what I want to do:

Set Error Capture [ On ]

Loop

Set Field [ Main::Loop, Main::Loop+1 ]

Enter Find Mode

Set Field [ Invoices::Contact ID, Main::contID ]

Set Field [ Product ID, GetRepetition(Main::Prods, Main::Loop) ]

Perform Find [ Replace Found Set ]

If [ Status(CurrentError) = 0 ]

Set Field [ Main::Tots-Loop, ItemSum ]

End If

Exit Loop If [ Main::Loop = Count(Main::Prods) ]

End Loop

Set Error Capture [ Off ]

It's that Set Field inside the IF where I want to set which Main::Tots (which - like Main::Prods) - is a 24 deep repeating field.

I'd like to use Main::Tots as an array... assigning the "repeat" dynamically - but I can't figure how. Any suggestions greatly appreciated!!!!!

TIA!

Link to comment
Share on other sites

Ouch. Well - y'all had some great code for dealing with dates - I'd hoped for similar magic this time - however - I can deal with it. *Now* I see a use for Exit script - since we don't know how many products the user will have in the list (1-24) when I reach whatever number it is - bail out of the "hard coded" chain of 24 steps...

At least now I know what to do (and stop looking for what I'd missed) - so it's off to see the Blue Angels doing their thing in the wild blue this afternoon - nice diversion!

Thanks for your help!!! --just knowing I hadn't "missed" something obvious truly is a great help - has anyone noticed F/M's documentation sucks?

Link to comment
Share on other sites

One workaround is to go to a layout that has only the repeating field on it and then execute a looping script that repeatedly goes to the next field and then exits if the current repetition number is equal to the target repetition. Then you can use the insert calculated result step to set the value. Ugly, but it works.

Link to comment
Share on other sites

Thanks - but actually - I found that just using 24

if(GetRepetition(myField,1)>"")

{find / sum / assign)

end if

(then after 24th IF)

some tiddying-up code

end of script

works just fine - as you say - ugly - but it works.

No offense - but I've found that F/M just isn't up to what I need in a db. 4D is suffering severely from "bloat" - F/M just hasn't got the juice - so I guess it's time to get serious about looking into Servoy or such. I did commit on this one project to add graphing and clean up some issues on an existing db for a customer - and do it in F/M. I *will* keep that commitment - but do I ever miss a few "vitals" - like arrays, real variables, scripts that aren't tied to anything (layouts) AND have universal "reach" - and most of all - schema that can be updated without worry about/with the data. F/M 7 is a step in the right direction (all tables in a single file) - they just need to take the next step.

Again THANKS for your help and suggestions - keeps me from making a (total) fool of myself!!!!

Link to comment
Share on other sites

This topic is 6484 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
 Share

×
×
  • Create New...

Important Information

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