Topic
Datensatz – Maximum
Startseite ' Community ' Automation and VBA ' Datensatz – Maximum
- Dieses Thema hat 5 Antworten sowie 2 Teilnehmer und wurde zuletzt vor vor 17 Jahren, 4 Monaten von Mustapha Ghazzouz aktualisiert.
-
AutorBeiträge
-
12.01.2008 um 00:07 Uhr #34859Mustapha GhazzouzTeilnehmer
In meinem C++-Programm habe ich ein Datensatz-Objekt. Wie kann ich davon dan Maximum berechnen? Ich denke es soll über die FPScript Funktion Maximum() gehen, aber wie das genau geht weiss ich nicht.
[code]IDataSetPtr fpDSet;
fpDSet = (IDataSetPtr)fpDB->GetObject((dataset_name), fpObjectTypeDataSet)double max;
max = fpDSet->??
[/code]Danke für die Hilfe
12.01.2008 um 00:07 Uhr #34864Mustapha GhazzouzTeilnehmerIn meinem C++-Programm habe ich ein Datensatz-Objekt. Wie kann ich davon dan Maximum berechnen? Ich denke es soll über die FPScript Funktion Maximum() gehen, aber wie das genau geht weiss ich nicht.
[code]IDataSetPtr fpDSet;
fpDSet = (IDataSetPtr)fpDB->GetObject((dataset_name), fpObjectTypeDataSet)double max;
max = fpDSet->??
[/code]Danke für die Hilfe
12.01.2008 um 03:27 Uhr #34860Bernhard KantzTeilnehmerCreate a FPScript formula in your database to calcuate the maximum. Alternatively you can do this with Automation. You get the result of the formula with the [b]value[/b]-property of the formula object.
VBA-Example: Maximum of the signal ‘Signal’
[code][/code]
…
Dim oFml As Formula
Dim value As Double
Set oFml = ActiveDatabase.RootFolder.Add(“Maximum”, fpObjectTypeFormula)
With oFml
.Formula = “Maximum(Signal)”
.Update
value = .value
End With
…
[/code]17.01.2008 um 20:01 Uhr #34861Mustapha GhazzouzTeilnehmerIch kenne zur Laufzeit aber den Datensatz-Name nicht. Kann ich diesen als Variable übergeben
sowas wie: .Formula = “Maximum(%oDst.Name)”
17.01.2008 um 22:34 Uhr #34862Bernhard KantzTeilnehmerYou could use String operators to create your FPScript code:
VBA:
[code]
.Formula = “Maximum(” & oDst.Name & “)”
[/code]18.01.2008 um 00:02 Uhr #34863Mustapha GhazzouzTeilnehmerAh ja ok.. thanks
so sieht der C/C++ Code aus, für die interssierten
[code] // Maximun-Formula
fpFrml_temp = (IFormulaPtr)fpDSet->GetParentFolder()->Add(“maxFormula”, fpObjectTypeFormula, fpNameClashHandlingOverwrite, _bstr_t(), _bstr_t());// Maximum-Formula-String zusammenstellen
char strFormulaMax[MAX_PATH];
strcpy_s(strFormulaMax, “Maximum(‘”);
strcat(strFormulaMax, (char *)fpDSet->GetName()); // _bstr_t in char * konvertieren
strcat(strFormulaMax, “‘)”);fpFrml_temp->PutFormula(strFormulaMax);
fpFrml_temp->Update();
max = fpFrml_temp->GetValue(fpDataComponentAll, column, 1);
fpFrml_temp->Delete(); // nicht mehr brauchbar[/code] -
AutorBeiträge
- Du musst angemeldet sein, um auf dieses Thema antworten zu können.