Using Databases in Interpreter

Hi,
my question:

can I do in the OnBeforePrint the following things?

Query.close
Query.Params[0] = NewValue
Query.Open
myNewValue = [Query."fieldname"]

I couldn't find a documentation about this


Thanks ;)
Willi

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 11:45PM
    Hi Willi
    which obp band or report component?
    where is query fr dialog or delphi form/dm ?
    ;)
  • edited 11:45PM
    Hi,
    I now found the following: In the OnBeforePrint of a MasterData band I entered this code: (the qry's SQLtext works with a Variable "aktLayout" as Parameter)

    begin
    DialogForm.qry.Close;
    aktLayout := 1706;
    DialogForm.qry.Open;
    showband(child1);

    DialogForm.qry.Close;
    aktLayout := 1707;
    DialogForm.qry.Open;
    showband(child1);
    end

    On a childband I print a DB-Field of qry. This works, but I get only 2 times the value with aktLayout=1707.

    How can I do this correctly ?

    Thanks
  • gordkgordk St.Catherines On. Canada.
    edited 11:45PM
    When using showband it will only appear the number of times you call show band.
    if you are trying to change the layout if a particular value is encountered in the md band and the Child belongs to mdBand or a band after
    then in obp of mdband
    if expression := true then
    change the connection of the mdband to which child you want and set the childbands' visible propertys accordingly.
    ;)
  • edited 11:45PM
    gordk wrote:
    When using showband it will only appear the number of times you call show band.
    if you are trying to change the layout if a particular value is encountered in the md band and the Child belongs to mdBand or a band after
    then in obp of mdband
    if expression := true then
    change the connection of the mdband to which child you want and set the childbands' visible propertys accordingly.
    ;)
    Thanks for your help,
    but of course it's OK, when it shows the child band only 2 times.
    But the first time it should show in the child the DB-Values with the parameter 1706, and the second time it should show the DB-Values of the parameter 1707. Both times it shows onyl the Values of parameter 1707
    That's my problem.
    ;)

    Willi
  • gordkgordk St.Catherines On. Canada.
    edited 11:45PM
    DialogForm.qry.Close;
    aktLayout := 1707;
    DialogForm.qry.Open;
    showband(child1);
    end

    it seems like the query is not being reset.
    this may be a problem when using the same query as the mdband is using.
    But try this
    give your query a name like query1 if you have more than 1 query on your dialog form.
    and try this
    query1.Close;
    aktLayout := 1707;
    query1.Open;
    showband(child1);
    end
    ;)

  • edited 11:45PM
    gordk wrote:
    DialogForm.qry.Close;
    aktLayout := 1707;
    DialogForm.qry.Open;
    showband(child1);
    end

    it seems like the query is not being reset.
    this may be a problem when using the same query as the mdband is using.
    But try this
    give your query a name like query1 if you have more than 1 query on your dialog form.
    and try this
    query1.Close;
    aktLayout := 1707;
    query1.Open;
    showband(child1);
    end
    ;)
    Thanks,
    but, I have only one query and this query has it's name.
    You can close a query, then set a parameter, then open the query, then it should show the new dataset, which I select with this "Where"-parameter
    ... and it has nothing to do with a "Reset", because it shows the values of the last parameter in all bands.

    Willi

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.