Trying to fill a field during a loop

Hey everyone,

New here and definitely do not consider myself a pro so be easy! haha.

Here is the section of code I’m having issues with. I’ve done this before in an old database that I no longer have and I do not remember it ever being this difficult.

Here is my code:

Field Marker2
loop
downrecord
until 10

I want to add “Top10” in the Marker 2 field but when I do:

Field Marker2
loop
“Marker2” “Top10”
downrecord
until 10

I get “Implicit assignment to current cell has been disabled” message. It’s been a while since I created a loop function but I have literally tried everything possible to fix this.

If I do this:

Field Marker2
loop
Fill “Top10”
downrecord
until 10

Then it fills the entire field instead of the 10 records but it does not throw the error.

How can I only fill the ten records?

Here’s the code you need.

loop
    Marker2="Top10"
    downrecord
until 10

In older versions of Panorama you could have done this:

field "Marker2"
loop
     "Top10"
     downrecord
until 10

This is no longer allowed, because it would make it easy to accidentally smash data. (There is a preferences to allow the old method to work, but I recommend leaving it un-set.)

1 Like

Instead of "Marker2" "Top10" you want to write Marker2="Top10"

When you are doing it that way, it doesn’t really matter which field is active, it will assign “Top10” to the Marker2 field because that is what the statement is telling it to do. You might want to put a FirstRecord statement before the loop for insurance.

If you want to do it without a loop, you would use FormulaFill.

Field Marker2
FormulaFill ?(seq()≤10,"Top10",Marker2)

This will put “Top10” in the field, if it’s one of the first 10 records, and it will place the field’s current contents in there for all the other records.

Dave, in ten seconds you make me want to hug you and bang my head on my desk in defeat. For two hours today, I tried everything and never thought of this. This fixed it. Thank you!

This is what I was doing. It kept erroring out and I thought I was losing my mind. Thanks for confirming I’m not imagining things! hahah