Jump to content
Server Maintenance This Week. ×

Autoenter calculation. Text field. Knowledge missing.


Recommended Posts

I have a text field with this autoenter calculation: List (Table::PrimaryID ; 1 ).

It works fine and returns the PrimaryID + carriage return + 1. No problem with that.

Is there a different behaviour if this field is used in a relationship that I don't know. Because in my solution, sometimes works some others it doesn't.

Thanks.

Link to comment
Share on other sites

2 hours ago, Enigma20xx said:

sometimes works some others it doesn't.

Hard to tell what "works" means. What are you hoping to accomplish by having this field, and how exactly does it "sometimes" fail? 

 

Link to comment
Share on other sites

It’s been a few years now, and I hoped you remember English is not my native language, so I would have some kind of excuse, 🤣🤣🤣

3 tables. TableA, XREF/JoingAB, TableB

From TableA via a portal I choose an ID from TableB (VL) to create a related record in the XREF/JoinAB. A field in this table (AB) autoenters a calculation ( List (TableB::Name ; 1 ).

Not always the autoenter calculations works, does the job, functions... Sometimes it appears John + carriage return + 1. And some other times it only appears 1.

And I don't know why this happens, and if it could be because I use this field in a relationship.

Link to comment
Share on other sites

15 minutes ago, Enigma20xx said:

autoenters a calculation ( List (TableB::Name ; 1 )

That's very different from:

3 hours ago, Enigma20xx said:

autoenter calculation: List (Table::PrimaryID ; 1 )

 

17 minutes ago, Enigma20xx said:

And some other times it only appears 1.

If only 1 appears, it means the auto-entered calculation was evaluated while there was no related record in TableB. Try changing the formula to something like:

Let (
trigger = B_ID
;
List (TableB::Name ; "1" )
)

where B_ID is the foreign key to TableB. Make sure the "Do not replace…" option is unchecked.


Still not sure why you need such normalization-breaking contraption.

 

Link to comment
Share on other sites

Shouldn't it be?

Let (
trigger = TableXREFAB::_ID
;
List (TableB::Name ; "1" )
)

or

Let (
trigger = TableXREFAB::TableB_IDf
;
List (TableB::Name ; "1" )
)

 

13 minutes ago, comment said:

Still not sure why you need such normalization-breaking contraption.

I try to make a filter for the portal. If the field has a name it shows it, but if it has 1, shows all.

Link to comment
Share on other sites

I believe it should be:

Let (
trigger = TableB_IDf
;
List ( TableB::Name ; "1" )
)

(Since the field is in the same table as TableB_IDf, there is no need to include the TO name.)

 

20 minutes ago, Enigma20xx said:

I try to make a filter for the portal. If the field has a name it shows it, but if it has 1, shows all.

There are simpler ways to accomplish this. Ways that will not break if the related value is modified and the auto-entered value remains unchanged.

 

Link to comment
Share on other sites

The new record doesn't get created in TableB, it gets created in the XREFAB table.

I can't reproduce the issue in my example file, but I can't figure out what happens to my real solution...

Ejemplo.fmp12

2 hours ago, comment said:

There are simpler ways to accomplish this. Ways that will not break if the related value is modified and the auto-entered value remains unchanged.

I'm open to advices... 🤣

Link to comment
Share on other sites

12 minutes ago, Enigma20xx said:

The new record doesn't get created in TableB, it gets created in the XREFAB table.

Yes, I understood that. But when you create that record and before you have entered a value in the TableB_IDf field, there is no related record in TableB, and the auto-entered calculation evaluates to "1".

 

15 minutes ago, Enigma20xx said:

I'm open to advices... 🤣

Here is the simplest way I could think of:

FilterByCategory.fmp12

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.