Hi Adrian,
I need to produce a report that contains data from a datasets that do not share a common owner:
Example:
Form1
|
--Query1
|
--Frame1
|
--Query1
So my instict told me to write the template tags like this
##Query1##
##Frame1.Query1##
But i got an error (dataset not found). Is it possible to produce a report like this?
Hi,
Thank you Adrian. I took a look at your code, tested it, and that is exactly what I needed.
Yesterday I wrote this piece of c++ code in order to implement a similar functionality:
TComponent* getSubComponent(TComponent* parent, const UnicodeString& cmpname)
{
int p;
if (cmpname.IsEmpty())
return parent;
else if ((p = PosEx(L".", cmpname)) == 0)
{
return parent->FindComponent(cmpname);
}
else
{
UnicodeString left = cmpname.SubString(1, p - 1);
UnicodeString right = cmpname.SubString(p + 1, cmpname.Length());
return getSubComponent(parent->FindComponent(left), right);
}
}
// ---------------------------------------------------------------------------
Variant __fastcall TFormBaseF::GetCaption(System::Variant const Parameters, const int High)
{
if (High != 0)
return L"Invalid number of parameters";
else
{
TUniControl ctrl = dynamic_cast<TUniControl*>(FindSubComponent(Parameters[0]));
return ctrl == NULL ? UnicodeString(L"Invalid name") : ctrl->Caption;
}
}
// ---------------------------------------------------------------------------
Variant __fastcall TFormBaseF::GetText(System::Variant const Parameters, const int High)
{
if (High != 0)
return L"Invalid number of parameters";
else
{
TComponent cmp = FindSubComponent(Parameters[0]);
TUniControl * c;
if (cmp != NULL && (c = dynamic_cast<TUniControl*>(cmp)))
{
return c->Text;
}
return UnicodeString(L"Invalid name"); // default
}
}
Well, that's another interesting way to do it, I hadn't thought of that. It is one thing that always surprises me on FlexCelReport: the functionality is limited, but there is a lot of ways to do workarounds with what's provided. FlexCelReport 6 (which I hopefully finally release this month) does add a lot of more interesting possibilities.