Propagate Problem

Test running the following code, which uses the Text List item selection in file A to lookup and process the item from file B (CONCDB2):

  opensecret "CONCDB2"
setactivedatabase "CONCDB2"
Selectall
removeallsummaries

select «CONC#»=val(array(lvConcChoice,1,tab()))AND yearvalue(«WE»)=yearvalue(date(array(lvConcChoice,3,tab()))) AND quartervalue(«WE»)=quartervalue(date(array(lvConcChoice,3,tab())))

Field «Item» 
   propagate

Field «CONC#»
   propagate

Field «AddTotal»
   total
Field «Sold»
    total

outlinelevel 1    
arrayselectedbuild lvArChoice,cr(),"",«Item»+tab()+«CONC#»+tab()+«AddTotal»+tab()+«Sold»
displaydata lvArChoice

Everything works but the two Propagate commands. They do work if I go to the CONCDB2 file and propagate the fields manually. “Item” is a text field, “CONC#” is an integer field.

You might put a stop statement after the select and see what’s actually being selected.

Michael’s suggestion is a good one, and I would also suggest that you run this procedure with a visible window so that you can see what is actually going on.

When running a procedure Panorama uses the exact same internal code as when you are running an operation from a menu choice. In fact, when you choose an item from a menu, Panorama X is actually running an invisible procedure for you. So there is literally NO difference between performing an operation “manually” and performing it with a procedure, they are one and the same. If there is a different outcome, it means that you are not doing quite the same thing. To make a long story short, I would think that the most likely possibility is a problem with the selection, as Michael suggested, but the only way to figure out for sure is to run the operation with a visible window.

I did use stop and it is selecting exactly what I want. And have been running in a visible window. The total calculations execute and are correct. I even copied and pasted the field names to make sure there were no hidden defects.

Just tried adding a few more fields to propagate, and none of them worked either. It did crash a couple of times after the selection and before display data. Couldn’t get it consistent enough to see exactly where.

I’m stumped. Next step, I guess is to create a new CONCDB2?

Here are before and after pictures (stopping before outlinelevel 1)

As produced by procedure:

After manually propagating:

Unless I’m missing something here I see the problem being that you are Propagating before you have created the summary record created by the Total commands. Try putting the two Propagate commands after the two Total commands. It was working manually because the summary record was already existing when you tried Propagating it from the Field menu.

I am noticing that you are using RemoveAll Summaries. Thus there are no summaries after that.

Propagate would not create a Summary Record. It would only fill empty cells with the value above them.

You then have a Total command. That would create a Summary record. Thus, when you procedurally do the Propagate, there is no Summary record to be propagated into. I am imagining that when you do it manually, you are not really doing it in the order that your procedure is doing it, but in fact are doing the Totals first (which creates the Summary Record), then the Propagates.

BINGO!

That was it. Thanks