Problem with formulafill lookupall(


#1

This code in a procedure is returning empty:

setactivedatabase “DEPREP_WORK"
Field “CONCCODE"
FormulaFill lookupall(“CCMASTERFILE”,“ApprovCode”,Agile,“ChargeCode”,”;”)

But if I do a manual formula fill with:

lookupall(“CCMASTERFILE”,“ApprovCode”,Agile,“ChargeCode”,";")

it returns the ChargeCode, as expected.

If I move the procedure code to an empty procedure and run it by itself, it works as expected.

Any troubleshooting tips?


#2

The only difference seems to be the change of the active database.
So what happens when you

  • put the lookup into a procedure in the activated database and
  • call that procedure from your code?

#3

Procedure is being run from the active database.

Did try putting the 3 lines of code in a separate procedure in that database. As I said, that worked as expected. Tried calling the test procedure from the original procedure and it fails.

An additional observation, the ForumulaFill runs VERY slow. Fewer than 100 records, but you can watch the fill take place.

FWIW: I changed the FormulaFill to FormulaFill “X” (to eliminate the lookupall as the cause) and it still did not fill the fields.


#4

Still having problems. It appears to be related to whatever the active database is, but even when I explicitly set the DB, it still doesn’t work. I’ve modified the code a bit, but it’s the same problem with formulafil. I’ll also add this is a procedure that worked fine in Pan 6 that I’m rewriting in Pan X.

What I have is a button on a form in the DB CCTotalsWork. The button calls a procedure,.buttons, which takes the button info and opens secret the DB DEPREP_WORK and far calls: farcall “DEPREP_WORK”,".depprocess"

.depprocess works down to this:

setactivedatabase “DEPREP_WORK”

Field «LOOKUPCODE»
formulafill «Agile»+«TRANSDATE»

Field «CONCCODE»
FormulaFill lookupall(“CCMASTERFILE”,“LOOKUPCODE”,LOOKUPCODE,“ChargeCode”,";")

The formula fill fails to fill anything in. I have the identical code in a procedure “TEST” in “DEPREP_WORK” and it fills in the fields correctly when run as a standalone. If called from within the .depprocess procedure the fields are not filled in. Likewise if TEST is far called from CCTotalsWork it will not fill in the fields.

Does formulafill change the active window?


#5

No.

I thought perhaps there was a bug with formulafill and “secret” windows, so I set up a test. It worked perfectly, so that’s not the problem.

Based on your description, I can’t really tell what the problem is, however.

The only scenario I can think of where a formulafill would not fill anything (but also not produce an error message) would be if there was a failed selection somewhere earlier. You might try putting a selectall statement just before the formulafill (or whatever the appropriate selection is).


#6

BINGO!
I have some cleaning out processes before the problem code that end with
selectreverse
removeunselected.

Apparently at this point it sees an empty data sheet. So selectall gives it something to work with.
It makes sense, but wasn’t a problem for me in Pan 6.

On to bigger and better problems.
Thanks