ORDERBY and CONDITION

Hello everyone !
I'm creating an app for different card.
In my card table I have a column type and character which is both a ref of another table.
In my character column need to sort character by their name but I need to valid it too about the type card.

ORDERBY(character[id], [name], FALSE)

NOT(AND([type].[name] <> "BATTLE", [type].[name] = "LEADER", ISNOTBLANK([character])))

 

Can we specified both in a valid if ?
Thanks in advance.

Solved Solved
0 3 171
1 ACCEPTED SOLUTION

Yes, you can specify both sorting and validation in your AppSheet app. Let's break down your requirements:

  1. Sorting: You want to sort characters by their name.
  2. Validation: The character is valid only if the card type is either "BATTLE" or "LEADER".

To achieve this, you can use a combination of ORDERBY() for sorting and AND(), OR(), ISNOTBLANK(), and other logical expressions for validation. In AppSheet, the Valid If constraint can be used to ensure that the data entered into a field meets certain conditions.

Here's how you can modify your expression:

 

ORDERBY(
    FILTER("Character", 
        OR(
            [RelatedType].[Name] = "BATTLE", 
            [RelatedType].[Name] = "LEADER"
        )
    ),
    [Name]
)

 

  • FILTER("Character", ...) is used to create a list of characters that meet the specified criteria (either "BATTLE" or "LEADER" type).
  • ORDERBY(..., [Name]) then sorts this filtered list by the character's name.

This expression should be placed in the Valid If constraint of the character column in your card table. This will ensure that only characters of the specified types ("BATTLE" or "LEADER") are considered valid and they will be sorted by their names.

View solution in original post

3 REPLIES 3

Yes, you can specify both sorting and validation in your AppSheet app. Let's break down your requirements:

  1. Sorting: You want to sort characters by their name.
  2. Validation: The character is valid only if the card type is either "BATTLE" or "LEADER".

To achieve this, you can use a combination of ORDERBY() for sorting and AND(), OR(), ISNOTBLANK(), and other logical expressions for validation. In AppSheet, the Valid If constraint can be used to ensure that the data entered into a field meets certain conditions.

Here's how you can modify your expression:

 

ORDERBY(
    FILTER("Character", 
        OR(
            [RelatedType].[Name] = "BATTLE", 
            [RelatedType].[Name] = "LEADER"
        )
    ),
    [Name]
)

 

  • FILTER("Character", ...) is used to create a list of characters that meet the specified criteria (either "BATTLE" or "LEADER" type).
  • ORDERBY(..., [Name]) then sorts this filtered list by the character's name.

This expression should be placed in the Valid If constraint of the character column in your card table. This will ensure that only characters of the specified types ("BATTLE" or "LEADER") are considered valid and they will be sorted by their names.

Ooh nice thank you

I used my custom GPT for this https://chat.openai.com/share/886dbb73-ecfd-45e1-a20f-fb6ce61f536f
Here is the original Post if you are interested.

Top Labels in this Space