1

How to set a default value for dynamic fields?

I'm using a dynamic field in a page view and I need to specify a default value for this dynamic field (Choice-dynamic) but I don't have this option... any idea how to do it?
Here's a screenshot of my options for the dynamic field:

I also checked in the options of the page view, to see if there was a section to run a script/function on page loading (to set a value for the field in question, if the option of a default value does not exist in the field itself), but I also came up empty-handed. I found nothing:

Any help would be appreciated!
Thanks in advance

9 replies

null
    • szormpas
    • 8 days ago
    • Reported - view

    Hi, is there a specific record of the 'Saisons' Table that you want to set as default?

      • Stef
      • 8 days ago
      • Reported - view

      Yes ! I would love the record 8 (because it's has the value "Actuelle"). And I want that specific record to be the default value ! Here is an extract from my ‘Saisons’ table :

    • John_Halls
    • 8 days ago
    • Reported - view

    Use the table level Trigger on new record: and add this code

    'Saison a afficher' := 8

    Regards John

      • Stef
      • 4 days ago
      • Reported - view

      Thanks for your answer !

      It actually doesn't work, since I'm not trying to set a default value for a new record, but I'm using the dynamic field (dynamic choice) to change parameters in the view field (see screenshot)

      Any ideas how to do this?  ☺

    • Fred
    • 3 days ago
    • Reported - view
     said:
    It actually doesn't work, since I'm not trying to set a default value for a new record, but I'm using the dynamic field (dynamic choice) to change parameters in the view field (see screenshot)

    Making sure I understand what you want.

    You are in a table that has a view element called Vue production.

    You have a dynamic field called Saison a afficher. Is this in the main table or in the subtable that Vue production shows?

    If it is in the main table, what is the name of the dynamic choice field in Vue production?

    Which dynamic field do you want set to choice 8?

    Can you upload a sample db?

    • Stef
    • yesterday
    • Reported - view

    Hello ! Thanks Fred for your reply 🙂 So, I'm trying to explain better my situation :

    I've created a page with a kind of dashboard, which displays data from a table called Spectacles. In this page, I use a View element to display the data and I've added a dynamic field (using information from another table, called Saisons) to filter the view.

    That's the code of my Dynamic value (calling the table Saisons)

    select Saisons where text(Statut) != "n/d"

    And that's the code of the formula in my view element :

    let choixsaison := text('Saison à afficher');
    select Spectacles where text(Saison) = choixsaison

    It works fine ! But when I open the dashboard, the dynamic field is empty, because I can't set a default value, so the view is empty too... To save me some clicks every time one open the dashboard, I'd like the default dynamic view not to be empty, but with the value 8 from the table Saisons (= 2024-2025). Any idea how to do that ?

      • Fred
      • yesterday
      • Reported - view

      You can try adding at tab at the top of the Edit Fields window.

      Then you can edit the top Tab's Trigger before view:

      Does that work for you?

      • Stef
      • 21 hrs ago
      • Reported - view

      Thank you ! I hadn't thought of this trick, but it now works with a tab at the very beginning of my fields ! 🙏🏼🤩  Have a wonderful weekend

      • Fred
      • 11 hrs ago
      • Reported - view

      Please mark the post answered when you get a moment.