cancel
Showing results for 
Search instead for 
Did you mean: 

Can you change column formats in child datawindows?

Former Member
0 Kudos

I have a child datawindow in a trailer band of a nested datawindow.  I use modify to attempt to change the display formats at run time, but, while this doesn't produce errors, neither does it change the format of the displayed data.   Should this work?

This is a sample modify string

paid.format="######0.00;(######0.00);######0.00" unpaid.format="######0.00;(######0.00);######0.00"

We are running PB12.5.2 Classic on Windows 8.1

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Did you put a check mark on the Use Format property? You should put a check on it to use the format.

As suggested above by Chris, you could also use EditMask.Mask instead of Format.

Former Member
0 Kudos

Hi Neil;

  Thanks for the reminder of this undocumented DW feature update to both PB 12.5.x Classic and PB.NET 12.5.x as well!  

- OR -

DC.Modify("Paid.EditMask.UseFormat=<Yes or No>")

Regards ... Chris

Former Member
0 Kudos

I've found the reason for my syntax errors - if you try to modify an editmask property and there is no editmask set up, then you get an error.

Answers (3)

Answers (3)

Former Member
0 Kudos

Happy New Year everybody!

I've tried this using the dot notation and looking at the format once assigned to confirm that it's changed.  Still no effect on the output report.  Just to confirm that I'm manipulating the correct datawindow, I hacked the original and the changes were reflected in the report, so that's not it.

I think that I've run out of options

Former Member
0 Kudos

So the current arrangement is that I modify the format string.  I check whether there is an editmask.mask value other than '?' or '!' and if so then I set the useformat flag to Yes.  There is similar code for datawindows and child datawindows.  Changing the font on the child works fine.  Changing the fonts works in all of these. Changing formats returns no errors, but has no visible effects in the child DWs.

There is some office folklore to the effect there are problems with modifying child DWs, but I can't find anything about this on the net.

Former Member
0 Kudos

Hi David;

  Tip: You might have to call the GroupCalc ( ) method after making changes to get the DWO's to redraw themselves properly after extensive Modifies.

Regards ... Chris

Former Member
0 Kudos

I'd tried it.  I've just double checked and it has no apparent effect.

Former Member
0 Kudos

Bummer ...

One last suggestion then:

1) SetReDraw ( FALSE)

2) Do your Modifies

3) SetReDraw ( TRUE)

Former Member
0 Kudos

This already happens.

Former Member
0 Kudos

Hi David;

  Are you sure that the MODIFY () method was working in the first place .. does your PowerScript check the return code from this command?

Regards ... Chris

Former Member
0 Kudos

It doesn't check this, but I debugged it and Modify() returns an empty string in this case.  We use similar syntax for updating columns in the detail line of a datawindow and this works as expected - in the example above, the numbers are displayed without commas etc.

Former Member
0 Kudos

Also ... don't forget that an EditMask "trumps" a display format at run time. So if you use the EditMask feature - you would also have to dynamically modify this format as well.  

Former Member
0 Kudos

This does sound plausible.   However, when I try doing a modify() along the lines of

paid.editmask.mask="#####0.00"

I get a syntax error at the = sign.

Former Member
0 Kudos

Should be something like:

DC.Modify ( "Paid.EditMask.Mask='#####0.00' ")

Former Member
0 Kudos

I still get the same errors i.e. syntax error at the '=' sign.   Since this datawindow is purely reporting I removed the editmasks and I now find that some of my columns are being updated. So... it seems that I'd shot myself in the foot with the editmasks, but there's something more obscure still wrong.  I'll revisit our code.

Former Member
0 Kudos

Did you make sure that you had the single quotes around the mask inside the Modify ( ) method?

Former Member
0 Kudos

Oh yes.  I have a nagging doubt that pasting the values in the debugger may have a bearing, so I'll try modifying the powerscript proper.