This topic is locked
[SOLVED]

 Child Add Page Lokup fields

11/14/2012 12:55:54 PM
ASPRunnerPro General questions
H
hsan author

i have a table with several dependent fields (Lookup Wizard). It is a child table, and on ADD page my first lookup field gets value from masterkey (becomes read-only, as it should) so none of autofill fields get populated. Also, my Javascript OnLoad Event that relates to some fields for this add page does not execute in this master-child scenario. How can i fix this? Help greatly appreciated.
Thanks,

Nash

admin 11/15/2012

Foreign key field will be populated automatically when you add a child record. You cannot use this field for Autofill purposes and the best option is to remove this field all together from the child Add page.
As a far as I understand you need to populate some fields on the Child Add page with values from the Master table. Here is how you can do this.

  1. Implement BeforeProcess event of Child Add page. In this event execute a SQL Query that retrieves data from the master record and save results in Session variables.
    The value of master key is stored in SESSION("<table name>_masterkey1") session variable where <table name> is the child table name.
    Examples of building a SQL Query and executing it:

    http://xlinesoft.com/asprunnerpro/docs/query.htm

    http://xlinesoft.com/asprunnerpro/docs/customquery.htm
  2. Use those session variables as default values of field you need to fill automatically. This is it.

H
hsan author 11/15/2012

Thanks Sergey again, as usual! I just want to ask you one more question - On one of my master-child pages, on add new record the child table frequently populates with wrong masterkey. What could be reason for that?
Thanks,

Nash

admin 11/15/2012

Unfortunately there isn't enough info to answer your question. If this is something that can be reproduced post your application to Demo Account and open a ticket at http://support.xlinesoft.com sending your Demo Account URL. 'Demo Account' button can be found on the last screen in the program.

H
hsan author 11/19/2012

Sergey,
Session variables work, except one field - it is text field and result is long string like:

REBUILD - FMJ 14'' VCO = MPI &amp; LOAD TE <a href="javascript:void(0);" query="fulltext.asp?pagetype=view&table=dbo_WorkProgress&field=PartDescription">More ...</a>

IS it query returning wrong fielf type or is it limitation of session variable?

admin 11/19/2012

Not sure I understand your last question. Please elaborate.

H
hsan author 11/19/2012

Sergey,
I've created "Add page:Before Process" event and captured text field "PartDesc" as session variable. I am using that variable as readonly value for the field on my add page. When I use text field "PartDesc" (part description, sometimes fairly long string) as Session Variable on add page it returns garbled output - instead of "REBUILD 24'' 500 TON ELEVATOR SPIDER -MPI & LOAD TEST" it will return

"REBUILD 24'' 500 TON ELEVATOR SPIDER -MP <a href="javascript:void(0);" query="fulltext.asp?pagetype=view&table=dbo_WorkProgress&field=PartDescription">More ...</a>"

admin 11/19/2012

If you have 'Truncate long text fields' option turned on for the table in question - turn it off on Miscellaneous screen.

H
hsan author 11/19/2012

I did that Sergey and now I am getting: " REBUILD 24'' 500 TON ELEVATOR SPIDER -MPI &amp; LOAD TEST". it looks like special characters " and & are causing problem.

H
hsan author 11/19/2012

EDIT:
Sergey, you do not get real picture of the output - as soon as I post the text changes. There is more garbled output around " sign.

H
hsan author 11/19/2012

Okay this is solved byView As: HTML for this readonly field. Thanks Sergey.