|
VB6 says the following expression is too complex
to be computed (provided by a genetic program):
(0.187385 +(0.149214 +oN1*(2.0092+oN1*(5.22783+1.9466*oN1)) +
oReu*(-0.0449582+oReu*(0.00420568+-0.000105206*oReu+0.0137505*oN1) +
oN1*(-0.361811+-0.34512*oN1)))*(-0.647353+(0.149214 +oN1*(2.0092+oN1*(5.22783+1.9466*oN1)) +
oReu*(-0.0449582+oReu*(0.00420568+-0.000105206*oReu+0.0137505*oN1) +
oN1*(-0.361811+-0.34512*oN1)))*(-5.2078)) +(0.0531293 +
oDP3*(0.260794+oDP3*(-0.0914714+0.00960239*oDP3)) +oOPT*(+oOPT*(+0.000904296*oDP3)
+oDP3*(-0.0286061+0.00372593*oDP3)))*(-5.25864+(0.0531293 +oDP3*(0.260794+oDP3*(-0.0914714+0.00960239*oDP3))
+oOPT*(+oOPT*(+0.000904296*oDP3) +
oDP3*(-0.0286061+0.00372593*oDP3)))*(37.8453+-71.5963*(0.0531293 +
oDP3*(0.260794+oDP3*(-0.0914714+0.00960239*oDP3)) +oOPT*(+oOPT*(+0.000904296*oDP3) +
oDP3*(-0.0286061+0.00372593*oDP3)))+-136.292*(0.149214 +oN1*(2.0092+oN1*(5.22783+1.9466*oN1)) +
oReu*(-0.0449582+oReu*(0.00420568+-0.000105206*oReu+0.0137505*oN1) +oN1*(-0.361811+-0.34512*oN1)))) +
(0.149214 +oN1*(2.0092+oN1*(5.22783+1.9466*oN1)) +
oReu*(-0.0449582+oReu*(0.00420568+-0.000105206*oReu+0.0137505*oN1) +
oN1*(-0.361811+-0.34512*oN1)))*(34.1411+55.7764*(0.149214 +oN1*(2.0092+oN1*(5.22783+1.9466*oN1)) +
oReu*(-0.0449582+oReu*(0.00420568+-0.000105206*oReu+0.0137505*oN1) +oN1*(-0.361811+-0.34512*oN1))))))
It contains several common bracketed sub expressions that could be simplified.
Is there any code to simplify this expression and compute it ?
Any suggestions?
aprx
|
|
|
|
|
And you needed VB6 to tell you this?
How are you getting this expression into your VB6 app? Are you cutting and pasting it directly into your code or are you sending the expression to something like VBScript to be evaluated?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi!
I got this expression from a genetic package, then
copied/pasted it in my VB written application.
It usually works but this time the expression is too large.
aprx
|
|
|
|
|
aprx wrote:
then
copied/pasted it in my VB written application.
Ewww... Your going to have to simplify it by hand, before you paste it in.
I suppose you could add expression evaluation support to your app, but that would be a massive undertaking almost as bad as rewriting the genetic package into your VB6 app directly. There are libraries out there that could probably do this, but you'll have to watch out for their capabilities because these libraries will also have limits on how complex the expression can be.
Yahoo search results for "vb6 expression evaluation[^]
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have created my crystal report and binded it to a crystalreportviewer. Once called everything works great. The report shows everything in the database. I am surprised I have gotten this far considering this is my first time using crystal reports with vb.net.
I am trying to only pass one row in and display the one row only. How is this accomplished? I want to pass values of the one row and one row only to the report and display it.
Thanks in advance
Beginner in VB.Net
|
|
|
|
|
there are a few ways you could do this.
you could select the data that you wish to display out of your current data source and copy it to a different dataset with the same structure. then set the datasource of the report = the dataset with just the single row.
or...
you could just do everything the way you are currently doing it and create a parameter for the report. in your code you set this parameter = the unique id for the row which yuo wish to display.
next, create a Record Selection Formula and have it select only the rows which match the parameter value. i used this method when i designed our company's new packing slip that we are now using in production.
each way has it's +'s and -'s, try them and see which way works out best for yuor particular application.
hope this helps.
-jim
|
|
|
|
|
Jim Matthews wrote:
you could just do everything the way you are currently doing it and create a parameter for the report. in your code you set this parameter = the unique id for the row which yuo wish to display.
next, create a Record Selection Formula and have it select only the rows which match the parameter value. i used this method when i designed our company's new packing slip that we are now using in production.
I would like to do it the way explained above. Do you have any examples of this?
In my database, the primary key is an autonumber named contactID. Is it possible to pass that value to the report and use it in the record selection formula? That sounds simple to do but don't know how to start it.
Thanks again
Beginner in ASP.Net and VB.Net
|
|
|
|
|
no problem.
i actually should have provided some source code here as the crystal objects are not very intuitive. (imho)
1. in your report create a parameter field called "ContactId"
2. in your report right click an empty area in the field explorer. go to "Report", then "Selection Formula" and then finally "Records". This should open the formula workshop. enter a formula for selection criteria like the following:
{Contact.ContactId} = {?ContactId}
where Contact is your table name and ContactId is the field which holds your unique constraint.
3. Now what you're going to do is pass the parameter value into the report via code.
'top of your object...
imports CrystalDecisions.CrystalReports.Engine
imports CrystalDecisions.Shared
'load your report
dim myReport as New ReportDocument
with myReport
.Load("myReportTemplate.rpt")
.SetDataSource(myDataSet)
end with
'determine which row you want to display
dim drToDisplay as Datarow = myDataSet.Tables("Client").Select("ClientId = " & cstr(currentClientId))
'get a reference to the reports parameter field
dim prmClientIdParameter as ParameterFieldDefinition
prmClientIdParameter = myReport.DataDefinition.ParameterFields("ClientId")
'create a parameter values collection to set the parameter value
dim valsParClientId as New ParameterValues
'create an instance of a parameter value to add to the above parameter values collection
dim valClientId as New ParameterDiscreteValue
valClientId.Value = drToDisplay("ClientId")
'add the parameter value to the parameters collection
valsParClientId.Add(valClientId)
'set the current value of the reports parameter field
prmClientIdParameter.SetCurrentValues(valsParClientID)
'--- code to display/print report etc ---'
that's pretty much it. watch out for spelling or syntactual errors above as i was typing this off of the top of my head just looking at some of my code. i didn't actually type it into the editor.
another thing to mention is
Brian Bischoff's free online crystal reports e-book.
hope this helps.
-jim
|
|
|
|
|
This all seems like it would work but I have one problem. I am using a form just for the crystalreportviewer. So I don't have access to my dataset. Do I need to create another dataset on this form, or is there a way around it?
Isn't there just a simple way to pass a string, that I already have(contactID), into the report without using the dataset?, then set that string equal to the parameter?, then display that record? I thought all this would be simple coding but it turned out to be a bigger task than I thought. Thanks for that link for the free e-book. I am going to read up on it but I would like to knock out this assignment first.
Thanks again for all your help.
Beginner in ASP.Net and VB.Net
|
|
|
|
|
no problem tim. you could just setup a friend property on your display form and pass in a reference to your report document object.
-jim
|
|
|
|
|
Jim Matthews wrote:
you could just setup a friend property on your display form and pass in a reference to your report document object
Sorry to be such a pain but could you show me how do to this?
Thanks so much for all your help and knowledge
Beginner in ASP.Net and VB.Net
|
|
|
|
|
Thanks Jim,
I downloaded the e-book that you recommended and found some great information on what I was looking for. I knew there was something simple I could do. Here is what I did.
I created a reportdocument from the toolbox under components and named it report1. I then added this code to my form load event.
Report1.DataDefinition.RecordSelectionFormula = "{MYTABLE.CONTACTID} =" & frmMain.strContactID
CrystalReportViewer1.ReportSource = Report1 This works perfect.
Thanks again for all your help and support;)
Beginner in ASP.Net and VB.Net
|
|
|
|
|
no problem tim.
take it easy.
-jim
|
|
|
|
|
Hey,
I have a treeview in my vb.net application. when i change the name of my treenode i am trying to reflect the change in my xml document and then repopulate the tree.
<category>
<name>Data To be Updated</name>
</category>
I can populate tree view, and rename the tree node but am unable to reflect the change in the xml
Any help would be greatly appreciated i have tried looking at examples but and unable to get anywhere.
thanks for any help in advance
|
|
|
|
|
How is your Treeview bound to the XML? Is it through a DataSet or is the TreeView just loading it from the .XML file directly?
The only way you can do something like this is if your Treeview is bound to a DataSet version of the XML file. When the data is changed in the Treeview, the DataSet can be updated. When the changes are complete, the DataSet can export back to an XML file. The Treeview control CANNOT do this.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hey,
I populate my tree using a recursive function to load hte xml file, and can add nodes to the tree which update the xml file using MSXML. Can i use MSXML to update the data between tags in the XML file:
<category>
<name>Data To be Updated</name>
</category>
(the tree node names) based on the selected tree node being renamed using the AfterLabelEdit command?
Thanks for the help
Chris
|
|
|
|
|
Well, since the TreeView control doesn't support Data Binding, you'll either have to add that support by creating a custom TreeView control or use a similar procedure to write the data back out that you used to get it into the TreeView.
You'll have to do some extra research on these methods to see what's going to work the best for your situation and requirements.
You might want to take a look at Extending the TreeView Control[^] on MSDN for a how-to on adding Data Binding.
When you rename a node in the Tree, the TreeView will fire a couple of events. You use the source data to find the appropriate node in the DataSet and update the data in the DataSet. Now, when your done, the DataSet object can write the resulting XML file back out for you. You won't have to iterate through the nodes and write eash one out by hand. That's why I highly suggest you use a DataSet object for your Tree data source.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks for your input, appreciate it.
I have managed to load the xml file in to a dataset before, but was unable to make the treeview use this dataset.
I will read that article and let you know how i get on.
Thanks again
Chris
|
|
|
|
|
Hey Dave,
I have written a function that can update the xml file using a DataSet.
My problem is I call this function in the AfterLabelEdit method and it runs.
But it updates the old name with the old name! as i cannot catch the new name that is typed in to the selected treenode until the AfterLabelEdit method as finished.
Do you have any suggestions of how to get the newly type name so when enter is pressed and the AfterLabelEdit method is run the new name can be used to update the old one using the update dataset function.
Thanks you for your help
Chris
|
|
|
|
|
What's the code in the event handler? Are you using the .Text property of the e.Node object that's passed to the handler? You will get the Node that was edited in the e.Node object AND you will get the new label text in the e.Label object.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hey,
Cheers again for the help, i have used a timer and made the AfterSelectEvent fire that. But will be changing my treenode to use a real dir structure soon, so i will keep that in mind thankyou.
Another question is that i am now using DSOFile to load MS Office file properties in to the form when the file node of my tree is double clicked.
This works and loads the file properties in to the form first time the node is double clicked, but if you try to go back to that file an error occurs saying that it cannot load the file properties because the file is open.
Is there anyway to close the file as soon as the properties have been retrieved?
Thank you for all your help
Chris
|
|
|
|
|
You can force the release of the underlying COM object by using Marshal.ReleaseComObject() on the instance of the DSO object you created. Try this:
Imports System.Runtime.Interop
.
.
.
' I'm assuming you're using the PropertyReadClass...
Dim dso As New DSOleFile.PropertyReaderClass
'
' Do whatever you need to with the object here...
'
' Now, release the unmanaged object and it's underlying resources.
Marshal.ReleaseComObject(dso)
' Drop our managed reference to the object.
dso = Nothing
.
.
.
And let the garbage collector do the rest...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hey,
Thanks for the reply. I have tried using the Marshal.ReleaseComObject but it does not seem to close the file, giving the error 'The file is open and cannot be read'. I have used hte import of InteropServices too.
my code is:
<br />
'DSO Properties<br />
Dim oDsoPropReader As DSOleFile.PropertyReader = New DSOleFile.PropertyReaderClass<br />
Dim oDsoFileProp As DSOleFile.DocumentProperties<br />
<br />
oDsoFileProp = oDsoPropReader.GetDocumentProperties(strFullPath) '<-- This line causes the error<br />
<br />
tbAuthor.Text = oDsoFileProp.Author<br />
tbFormat.Text = oDsoFileProp.AppName<br />
lblDateCreated.Text = oDsoFileProp.DateCreated<br />
lblDateModfied.Text = oDsoFileProp.DateLastSaved<br />
<br />
Marshal.ReleaseComObject(oDsoPropReader)<br />
<br />
oDsoFileProp = Nothing<br />
oDsoPropReader = Nothing<br />
Is my code wrong?, this help is really appreciated.
Chris
|
|
|
|
|
I have solved hte problem i also released the DocumentProperties as well as the reader, thanks for all your help Dave.
Chris
|
|
|
|
|
http://www.thecodeproject.com/vb/net/classinspector.asp[^]
This is a great little tool that can make implementing a snap.
There is a minor bug in the program that truncates some properties.
For instance, the Textbox property _PasswordChar has a default of Chr(0) which is a 'null.' The problem is that the textbox sees a null as an EOF and truncates the string. A simple solution is to remove the null char. To do this, change the line in showEnum and showControlProps from currentText = sb.ToString to read currentText = sb.ToString.Replace(Chr(0), "")
|
|
|
|