PDA

View Full Version : Property Exchange - Report Control



chuckatkinson
24-Nov-2009, 10:28 AM
Hi,

Off on a new tangent. Just discovered the ability to save ReportControl settings in an XML file. This is ideal for our application as I was saving some of the user settings in external file which was working okay for them. But it could be better if their current reportcontrol settings could be saved in the file as well. I sort of have it working but am having problems loading the user settings.



Get psPX_Class of ghoReportControl to sSection

Get ComCreateAsXML of ghoSigCjPropEx False sSection to bOk

If bOk Begin
Send ComDoPropExchange of ghoReportControl (pvComObject(ghoSigCjPropEx)) sSection
Send ComExchangeString of ghoSigCjPropEx "LastSql" sLastSql C_ClearSQL
Send ComSaveToFile of ghoSigCjPropEx sXML_File
End


The "ExchangeString" sample says
'This will create a node named "CustomerName" under the "CustomerInformationNode"
pxWrite.ExchangeString "CustomerName", StrName, ""


But my code doesn't seem to create a new node in the XML? It does write the value in the XML.



<SigCjReportControl CompactMode="1" Schema="36" ShowGroupBox="1" FreezeColumnsAbs="1" MovePivot="1" ShowIconView="0" LastSql="and ( msstock.branch = '01' or msstock.branch = '02' or msstock.branch = '79' ) and ( msstock.pref_vendor = 'AMCR ' ) ">

And when doing the load it does not find the "LastSql" value.

I am currently reading about GetSection ... Am I going in the right direction?
Thanks

Ian Smith
24-Nov-2009, 12:53 PM
Hi Chuck

We tried using XML and changed to the registry option, the conclusion was that it does not work as described. When saving setting to a file, the file is replaced. So if your file contains settings for several users they all have to be read and store and when you want to save the settings the setting for all users have to be saved. It will not update the settings for an individual user.

If you have not found it our mixin is in cSigCJPropEx_Mixin.pkg

We can add the ability to save custom string / integer values if required.

chuckatkinson
24-Nov-2009, 02:31 PM
Hi Chuck

We tried using XML and changed to the registry option, the conclusion was that it does not work as described. When saving setting to a file, the file is replaced. So if your file contains settings for several users they all have to be read and store and when you want to save the settings the setting for all users have to be saved. It will not update the settings for an individual user.

If you have not found it our mixin is in cSigCJPropEx_Mixin.pkg

We can add the ability to save custom string / integer values if required.

Yes I'm finding the same thing. I got kinda excited by the possibilities. I can actually get it to work with the reportcontrol settings and it's not a problem for us storing multiple users since each user has their own file (or actually can have several named files).

I can save the Section ("Buyer") in the xml that I need along with the data, but I can't for the life me get the value when loading the file.

Here's what I've tried when loading the xml


Get psPX_Class of ghoReportControl to sSection

Get ComCreateAsXML of ghoSigCjPropEx True sSection to bOk

Get Create U_cCJPropExchange to hoExchangePref
Get ComGetSection of ghoSigCjPropEx "Buyer" to vSection
Set pvComObject of hoExchangePref to vSection

If bOk Begin
Get ComLoadFromFile of ghoSigCjPropEx sXML_File to bOk
If bOk Begin
Send ComDoPropExchange of ghoReportControl (pvComObject(ghoSigCjPropEx)) sSection
Send ComExchangeString of hoExchangePref "Buyer" sTest ""
Send ComExchangeString of hoExchangePref "LastSql" sTest ""
End
End


The two ComExchangeString calls above was my attempt to see if I could get anything back...

I can see the Section and value in the xml file as I created them and as you can see at the end of the file below.



<<<<<<<<< BIG SNIP >>>>>>>>>>>>>>>>>>>
<Header AutoColumnSizing="0" ShowItemsInGroups="0"/>
<Buyer LastSql="and ( msstock.branch = '01' ) and ( msstock.pref_vendor = 'AMCR ' or msstock.pref_vendor = 'AMCC ' ) "/>
</SigCjReportControl>


But no matter what I try, I can't get ComExchangeString to return the value from the file for LastSql

I must be missing something important. Probably my understanding of how ComExchangeString works ...:confused:

Ian Smith
30-Nov-2009, 04:24 AM
Hi Chuck

Sorry for the delay, I have been out of "comms range".

The value has to be a constant or passed ByRef when being set and MUST be passed ByRef when being got. (Yes... these are VDF ByRefs and not C pointers).

chuckatkinson
30-Nov-2009, 03:23 PM
Hi Ian,

Thanks for getting back to me. I'm still kinda frustrated with this, but have it working.

I was off in the weeds trying to make a new section in the XML file. And it seems you are correct about it not working.

ByRef was just the trick getting ComExchangeString working.

I would still like to create new sections in the XML file so I can have multiple layouts stored there. Do you think this is a waste of time?

Thanks for your help.

Martin
1-Dec-2009, 04:08 AM
Chuck, Personal I wouldn’t go down this road, the Property Exchange works well for keeping track of user setting for the control I wouldn’t use it for store extra info as Codejock my change the way it works. As you know currently we use the windows registry for storing the user setup for all the Codejock controls, we tried the xml way but in the end decided to keep it in the same format and method that DAW use. For extra user information we could use the Registry, XML, table or ini file!
We could do with a way of storing the filter information for each user, so if you go down this road maybe we could do something together and publish the results.

chuckatkinson
1-Dec-2009, 08:59 AM
Martin,

Thanks for the feedback. Actually I am quite happy with the VDFSIG/DAW way of storing the user setup in the registry. And I still do use this feature.

In our program (called Buyer Worksheet) I designed a "Build Worksheet" dialog where the user makes selections from vendors etc to display data on the report. The selections are compiled into a SQL select statement and then applied via the Mertech SQL_CONSTRAINT to the database table for the ReportControl. I already had a simple system in place for the user to save the SQL statement to a file so they could re-run their reports easily. What was lacking IMHO was having the ReportControl settings stored with the SQL so the user would again see the report exactly as they designed it. So I merely "hijacked" my existing file save/load behaviour in the program so it would store the reportcontrol settings in the file along with the SQL.

Actually I am hoping Codejock changes the way the xml file thing works :D IMHO it doesn't work as advertised.

As always, I am willing to contribute anything I can to VDFSig.

Martin
8-Dec-2009, 05:15 AM
Thanks for the update. :)

Ian Smith
8-Dec-2009, 05:50 AM
Hi Chuck


Actually I am hoping Codejock changes the way the xml file thing works :D IMHO it doesn't work as advertised.

I agree, it does not work as advertised. I also would not hold my breath. When we did the property exchange I opened up a support incident with Codejock and the impression I got was "it works as it does" and that there were no plans to change / improve it.