Bug when referencing value from another column

Hi community,

I have come across a weird behavior on my app, and I have no idea what could be the problem. Maybe I am missing something? Not sure. Hopefully, you can help me figure it out

I have divided my tableโ€™s form into two sections โ€œLoad Detailsโ€ and "Delivery Details"

Each section has the following structure:

โ†’ Load Details Section

  • [PickUp Docket] :

SHOW?: [No_PU_Docket] = โ€œDocketโ€
INITIAL VALUE: IF(([No_PU_Docket] = โ€œNo Docketโ€), ([ID].[Delivery Docket]), [PickUp Docket])
RESET ON EDIT?: Contains([No_PU_Docket],โ€œNo Docketโ€)

  • [PU Gross Weight] :

SHOW?: [No_PU_Docket] = โ€œDocketโ€
INITIAL VALUE: IF(([No_PU_Docket] = โ€œNo Docketโ€), ([ID].[DEL Gross Weight]), [PU Gross Weight])
RESET ON EDIT?: Contains([No_PU_Docket],โ€œNo Docketโ€)

  • [PU Net Weight] :

SHOW?: [No_PU_Docket] = โ€œDocketโ€
INITIAL VALUE: IF(([No_PU_Docket] = โ€œNo Docketโ€), ([ID].[DEL Net Weight]), [PU Net Weight])
RESET ON EDIT?: Contains([No_PU_Docket],โ€œNo Docketโ€)

โ†’ Delivery Details Section

  • [Delivery Docket] :

SHOW?: [No_DEL_Docket] = โ€œDocketโ€
INITIAL VALUE:IF(([No_DEL_Docket] = โ€œNo Docketโ€), ([ID].[PickUp Docket]), [Delivery Docket])
RESET ON EDIT?: Contains([No_DEL_Docket],โ€œNo Docketโ€)

  • [DEL Gross Weight] :

SHOW?: [No_PU_Docket] = โ€œDocketโ€
INITIAL VALUE: IF(([No_DEL_Docket] = โ€œNo Docketโ€), ([ID].[PU Gross Weight]), [DEL Gross Weight])
RESET ON EDIT?: Contains([No_DEL_Docket],โ€œNo Docketโ€)

  • [DEL Net Weight] :

SHOW?: [No_PU_Docket] = โ€œDocketโ€
INITIAL VALUE: IF(([No_DE_Docket] = โ€œNo Docketโ€), ([ID].[PU Net Weight]), [DEL Net Weight])
RESET ON EDIT?: Contains([No_DEL_Docket],โ€œNo Docketโ€)

All the columns are giving the expected result except [PU Gross Weight] and [DEL Gross Weight], in only two specific cases:

Case 1:

  1. I press โ€œNo Docketโ€ on [ [No_PU_Docket] from the โ€œLoad Details Section.โ€
  2. I complete the columns on the โ€œDelivery Details Section.โ€

All the columns from the loadโ€™s section return the correct value except the [PU Gross Weight]. It only returns a value when I press โ€œNo Docketโ€ again even though it is already marked as โ€œNo Docket.โ€

Case 2:

  1. I press โ€œNo Docketโ€ on [No_DEL_Docket] from the โ€œDelivery Details Section.โ€
  2. I complete the fields on the โ€œLoad Details Section.โ€

All the columns from the Delivery section return the correct value except the [DEL Gross Weight]. It only returns a value when I press โ€œNo Docketโ€ again even though it is already marked as โ€œNo Docket.โ€

Sorry for the long post. I tried to be as specific as possible so you can picture it properly.

Thanks for your time !

1 11 329
11 REPLIES 11

In what way are the values incorrect?

This [ID] column is a ref to another table, are you sure the values are correct there? How is the reference set?

What data types are the [No_PU_Docket] and [No_DEL_Docket] columns, and why do you check a simple equality to โ€œNo Docketโ€ in one case, but use CONTAINS() in another?

What exactly do you mean by:

Screenshots typically are much more helpful than text, post a few of the situation.

Hi @Marc_Dillon,

  • In what way are the values incorrect?
    The expression returns blank.

  • This [ID] column is a ref to another table, are you sure the values are correct there? How is the reference set?
    The [ID] column is part of the same table โ€œLoadsโ€. Values must be correct because the expression works with the other columns except [Gross Weight].

  • What data types are the [No_PU_Docket] and [No_DEL_Docket] columns, and why do you check a simple equality to โ€œNo Docketโ€ in one case, but use CONTAINS() in another?
    These columns are of type โ€œEnumโ€ and the values are โ€œDocketโ€ and โ€œNo Docketโ€.

This is how it looks on the form.

Load Details Section:

3X_a_b_ab037828adb1f4317f2f7892dba75fd4b6723aa4.png

Delivery Details Section:

3X_4_0_403466e75148ae201b676295a6cea00df794425b.png

So, the dynamic is: if the user has a docket to provide; the user must to tap โ€œDocketโ€ and the form will display the respective fields. If the user does not have a docket, the user must tap โ€œNo Docketโ€ and the form will auto-fill the fields with the values from the other section.

Hopefully this video helps:

Does [ID] point to the row being edited in the form, or to a different row?

Hi Steve,

It points to the row being edited.

Then itโ€™s entirely unneeded. Remove the occurrences of [ID]. where it refers to the same row.

I have removed the [ID] from the expressions, and now Iโ€™m getting this error

Do you know how can I fix it? I tried replacing the column that is causing the circular definition with a blank like shown below, but no change.

F(([No_PU_Docket] = โ€œNo Docketโ€), [Delivery Docket], " ")

Well, the use of [ID]. was definitely the cause of the odd behavior, and it was masking a deeper problem. Unfortunately, your app is much more complex than Iโ€™m prepared to troubleshoot. Youโ€™ll need to find someone else to dig into this with you.

PU gross weight equals Del gross weight, and Del gross weight equals PU gross weight, essentially. Yes, you have some further conditions on top of that, that you may think wonโ€™t create a circular definition situation, but Appsheet still wonโ€™t allow it.

Iโ€™d suggest trying to explain in plain english what the data collection goal is here.

The App collects the details for the loads delivered daily; details like load time duration, delivery time duration, load dockets, and delivery dockets. It also calculates whether the load is within the legal mass limits depending on the gross load weight entered. That is why I must always have a value on the [PU Gross weight].

I just thought maybe I could write an expression that uses the delivery weight if there is no Pick-Up docket. I will work on that.

Thanks, everyone for your help and time

So why do the weights have to refer to each other, Isnโ€™t one always going to be entered first, and one entered later on (or if not, just copy the weight from the first)?

haha I do not know . That is how I thought of it at first, but yeah, there is a more efficient way to achieve it. I will work on it.

Thanks

Top Labels in this Space