Page 1 of 1

Problem with Display field working in Browse, but not in Edit

Posted: Sat Jun 10, 2023 3:22 am
by camti
Hello,
I have a problem with a Display field:
In the Browse view it shows up exactly as expected, using this statement

Code: Select all

CONCAT (pro_short_name,'-#',pma_serial_nr)
Whereas in the Edit view, the field remains blank...

Any hints anyone how to fix this?

Re: Problem with Display field working in Browse, but not in Edit

Posted: Sat Jun 10, 2023 10:12 am
by kev1n
Hi,

In the Display object, please ensure that you provide a complete and fully qualified SQL statement, such as

Code: Select all

SELECT CONCAT (pro_short_name,'-#',pma_serial_nr) FROM your_table

Re: Problem with Display field working in Browse, but not in Edit

Posted: Sun Jun 11, 2023 1:34 am
by camti
As you suggested, I have added the table to the statement, but this did not give the result expected, the field is unchanged and still empty.

Here is how I have amended the SQL in the Display tab of the Display field in question, but there must still be some error which I don't see...:

Code: Select all

CONCAT (tab_product.pro_short_name,'-#',tab_product_manuf.pma_serial_nr)

FROM
    tab_product_manuf
        JOIN tab_product ON tab_product.tab_product_id = tab_product_manuf.tab_product_manuf_id
In the Browse section of the corresponding form, I have those statements, which yield the expected results:

Code: Select all

CONCAT (pro_short_name,'-#',pma_serial_nr)
,

and in the SQL section this

Code: Select all

SELECT
 tab_product.pro_short_name,
    tab_product.pro_long_name,
    tab_product.pro_order_nr,
    tab_product_manuf.pma_serial_nr,
    tab_product_manuf.pma_product_id,
    tab_product_manuf.pma_jointid,
    tab_product_manuf.pma_customer_id,
    tab_customer.cus_name_official,
    tab_customer.cus_name_internal

FROM
    tab_product
        JOIN tab_product_manuf ON tab_product_manuf.pma_product_id = tab_product.tab_product_id
        JOIN tab_customer ON tab_customer.tab_customer_id = tab_product_manuf.pma_customer_id
Could you see why the expected result is displayed in the Browse View, and not in the Edit View?
Thanks in advance!

PS: in the ID field of the Object properties, I have written a "fantasy name", which I assume is okay, right?

Re: Problem with Display field working in Browse, but not in Edit

Posted: Mon Jun 12, 2023 8:15 am
by kev1n
Presumably, you want to display the data of the current record?
In that case, you still need to specify a restriction on the record.

e.g.

Code: Select all

WHERE your_primary_key_column = '#RECORD_ID#'
If you do not obtain the expected results, it is advisable to execute the query using a tool like phpMyAdmin. This will allow you to verify if the output meets your requirements. Remember to substitute '#RECORD_ID#' with the actual ID of the record you are targeting.
PS: in the ID field of the Object properties, I have written a "fantasy name", which I assume is okay, right?
Yes, you can do that.