ValidIf to prevent form from saving if another survey already exists

Evening…

ValidIf…???

I’d like to prevent my survey_Form saving if any asset in [asset_name] also exists in the survey table [asset_name] column. This is to prevent a new survey starting from this survey_Form if a survey already exists.

Two things to note:

  1. [asset_name] is an EnumList Ref Type that uses a ValidIf to produce it’s list from the asset table.

  2. When the survey_Form is saved an action extracts each name from [asset_name] and creates a new row for each in the survey table - so the survey table will always only have one name in [asset_name] even though it’s an EnumList in the form.
    .
    .
    .
    The [asset_name] ValidIf is already in use so the approach I’ve been trying is for a separate column [validate_this_survey] to have a ValidIf that says:

NOT(
   IN(
   ANY([asset_name]),

SELECT(
	survey[asset_name],
	AND(
    [LCS] = [_THISROW].[LCS],
    [select_cabinet_to_survey] = [_THISROW].[select_cabinet_to_survey]
    ))
    )
    )

.
I’m trying to force an error if any asset in [asset_name] also exists in the survey table but I’m failing.

Any assistance would be greatly appreciated.

Thanks…
.
.

survey_Form

survey table

0 9 652
9 REPLIES 9

Steve
Platinum 4
Platinum 4

Remove existing surveyed assets from this list using list subtraction, described here:

I didn’t think of doing it that way round…! Thanks @Steve

Hi @Steve,

Thanks… I’ve now made some progress on the [validate_survey] column.

[validate_survey] now always matches [asset_name] except when the existing survey asset names from the survey table have been subtracted.

When that happens, [validate_survey] appears blank/empty. So I tried the following to trigger the error:.
.
[validate_survey] Valid If

ISNOTBLANK([validate_survey])

[validate_survey] Initial Value

[asset_name]
-
SELECT(
	survey[asset_name],
	AND(
    [LCS] = [_THISROW].[LCS],
    [select_cabinet_to_survey] = [_THISROW].[select_cabinet_to_survey],
    NOT([branch_info] = "computed")
    ))

.
Sorry but there’s something about Valid If that I don’t quite get… Please could you point out where I’m going wrong…?
.
.



That is exactly equivalent to no Valid If expression but setting Required? to ON. You should remove that Valid If expression and set Required? to ON.

The expression you’re trying to construct (if I understand your goal correctly) should be in Valid If, not Initial value. By putting an expression that produces a list result inValid If, you’ll be giving the user a dropdown list of valid options to choose from. The user won’t have an opportunity to choose an invalid option (if your expression is written properly).

In designing the Valid If expression, you want to generate a list of all possible valid values, the remove from that list the values that should not be available currently (i.e., because they’re in use elsewhere). How can you generate a list of all possible asset_name values (not just those currently in use)?

Hi @Steve,

Thanks for your detailed response…

I am currently using a few Valid If expressions in my forms as you suggested and I use Initial Value expressions as well to pre-populate some Enum Lists.

I may have asked my original question badly…

What I’m trying to do is invoke a “Data Validity” situation so that I can force an “Invalid Value Error” message (preventing a user from saving the form) until they select different form options that release the “Error Trigger” i.e. the [asset_name] column.

I still haven’t figured this one out!

.
.

Based on your previous suggestion, I went back into my [asset_name] Valid If and inserted a list to subtract any previously surveyed asset names which modifies the form’s previous behaviour. Now the form will only show asset names that have not been started/finished previously. That’s great thanks!
.

-SELECT(survey[asset_name],
	AND(
	[LCS] = [_THISROW].[LCS],
    [select_cabinet_to_survey] = [_THISROW].[select_cabinet_to_survey],
    [sub_asset] = [_THISROW].[sub_asset],
    [select_asset_type] = [_THISROW].[select_asset_type],
    NOT([_THISROW].[branch_info] = "computed")
    ))

.
The result is that the [asset_name] column is BLANK in the form when it comes across a scenario where something was surveyed before i.e.

6 assets were proposed in the Enum List then…
6 previously surveyed assets were discovered and subtracted and…
0 assets remain in Enum List and it disappears in the form (BLANK?)
.
Here’s an example where CAT6A has no asset names to display:
.
3X_e_a_ea335d095edbe04808ce28ef71d45bc05f57744d.png
.
And here’s one where Fibre does have asset names to display:
.


.
.
.
.

.
You may regret having asked this one as the inefficiency of these expressions is either going to make you laugh or cry so loud you may do yourself a mischief…
.
.
.
.
[asset_name] Valid If

IFS(

[survey_type] = "Node",

ORDERBY(
	SELECT(asset[id],
	IN([id],
	SORT(
	UNIQUE(
	SELECT(rf_design[Source Asset ID],
	AND(
	[lcs] = [_THISROW].[lcs],
      [main_asset_name] = [_THISROW].[select_cabinet_to_survey],
      [sub_asset_name] = [_THISROW].[sub_asset],
      [source_asset_type] = [_THISROW].[select_asset_type],
    	NOT([_THISROW].[branch_info] = "computed"),
      NOT(
      	AND(
          LEFT([sub_asset_name], 3) = 'HPR',
      				[source_asset_type] = 'Fibre',
      				[destination_asset_type] = 'HPR'
      				))
      ))
	+SELECT(rf_design[Destination Asset ID],
	AND(
	[lcs] = [_THISROW-2].[lcs],
      [main_asset_name] = [_THISROW-2].[select_cabinet_to_survey],
      [sub_asset_name] = [_THISROW-2].[sub_asset],
      [destination_asset_type] = [_THISROW-2].[select_asset_type],
      NOT([destination_asset_type] = 'Cabinet'),
    	NOT([_THISROW].[branch_info] = "computed"),
      NOT(
      	AND(
          LEFT([sub_asset_name], 3) = 'HPR',
      				[source_asset_type] = 'Fibre',
		      		[destination_asset_type] = 'HPR'
    		  		)),
      NOT(
      	AND(
          		[main_asset_name] = [sub_asset_name],
      				[source_asset_type] = 'Fibre',
      				[destination_asset_type] = 'HPR'
      				))
      ))
	-SELECT(survey[asset_name],
	AND(
	[LCS] = [_THISROW].[LCS],
      [select_cabinet_to_survey] = [_THISROW].[select_cabinet_to_survey],
      [sub_asset] = [_THISROW].[sub_asset],
      [select_asset_type] = [_THISROW].[select_asset_type],
    	NOT([_THISROW].[branch_info] = "computed")
      ))
      ),FALSE
			)),TRUE
			),[asset_name]
			),

[survey_branch_number] = 1,

ORDERBY(
	SELECT(asset[id],
	IN([id],
	SORT(
	UNIQUE(
	SELECT(rf_design[Source Asset ID],
	AND(
	[lcs] = [_THISROW].[lcs],
      [main_asset_name] = [_THISROW].[select_cabinet_to_survey],
      [sub_asset_name] = [_THISROW].[sub_asset],
      [source_asset_type] = [_THISROW].[select_asset_type],
    	NOT([_THISROW].[branch_info] = "computed"),
      NOT(
      		AND(
        	LEFT([sub_asset_name], 3) = 'HPR',
      		[source_asset_type] = 'Fibre',
      		[destination_asset_type] = 'HPR'
      		))
      ))
	+SELECT(rf_design[Destination Asset ID],
	AND(
	[lcs] = [_THISROW-2].[lcs],
      [main_asset_name] = [_THISROW-2].[select_cabinet_to_survey],
      [sub_asset_name] = [_THISROW-2].[sub_asset],
      [destination_asset_type] = [_THISROW-2].[select_asset_type],
      NOT([destination_asset_type] = 'Cabinet'),
    	NOT([_THISROW].[branch_info] = "computed"),
      NOT(
      	AND(
    		  LEFT([sub_asset_name], 3) = 'HPR',
  	   			[source_asset_type] = 'Fibre',
	     			[destination_asset_type] = 'HPR'
      				)),
      NOT(
      		AND(
          		[main_asset_name] = [sub_asset_name],
      				[source_asset_type] = 'Fibre',
      				[destination_asset_type] = 'HPR'
      				))
       ))
	-SELECT(survey[asset_name],
	AND(
	[LCS] = [_THISROW].[LCS],
      [select_cabinet_to_survey] = [_THISROW].[select_cabinet_to_survey],
      [sub_asset] = [_THISROW].[sub_asset],
      [select_asset_type] = [_THISROW].[select_asset_type],
    	NOT([_THISROW].[branch_info] = "computed")
      ))
    	),FALSE
	)),TRUE
	),[asset_name]
	)

	-SPLIT(survey[planned_asset_id], ",")
	-[branch_A_assets]
	-[branch_B_assets]
	-[branch_C_assets]
	-[branch_D_assets]
	-[branch_E_assets],

[survey_branch_number] > 1,

SPLIT(
	SELECT(
	survey[survey_asset_id],
  	AND(
	[survey_type] = "Cable",
	[LCS] = [_THISROW].[lcs],
	[select_cabinet_to_survey] = [_THISROW].[select_cabinet_to_survey],
	[sub_asset] = [_THISROW].[sub_asset],
    [select_asset_type] = [_THISROW].[select_asset_type],
    [survey_branch_number] = [_THISROW].[survey_branch_number],
    [branch_info] = "new branch"
    )),
    ","
    )

-SPLIT(
	SELECT(
	survey[planned_asset_id],
  	AND(
	[survey_type] = "Cable",
	[LCS] = [_THISROW].[lcs],
	[select_cabinet_to_survey] = [_THISROW].[select_cabinet_to_survey],
    [sub_asset] = [_THISROW].[sub_asset],
	[select_asset_type] = [_THISROW].[select_asset_type],
    [originating_branch] = [_THISROW].[survey_branch_number],
    NOT([branch_info] = "computed")
    )),
    ","
    )

-SELECT(survey[asset_name],
	AND(
	[LCS] = [_THISROW].[LCS],
    [select_cabinet_to_survey] = [_THISROW].[select_cabinet_to_survey],
    [sub_asset] = [_THISROW].[sub_asset],
    [select_asset_type] = [_THISROW].[select_asset_type],
    NOT([_THISROW].[branch_info] = "computed")
    ))
    
    -[branch_A_assets]
		-[branch_B_assets]
		-[branch_C_assets]
		-[branch_D_assets]
		-[branch_E_assets]

    )

.
.
.
.
[asset_name] Initial Value

IFS(

[survey_branch_number] = 1,

ORDERBY(
	SELECT(asset[id],
	IN([id],
	SORT(
	UNIQUE(
	SELECT(rf_design[Source Asset ID],
	AND(
	[lcs] = [_THISROW].[lcs],
      [main_asset_name] = [_THISROW].[select_cabinet_to_survey],
      [sub_asset_name] = [_THISROW].[sub_asset],
      [source_asset_type] = [_THISROW].[select_asset_type],
    	NOT([_THISROW].[branch_info] = "computed"),
      NOT(
		AND(
        	LEFT([sub_asset_name], 3) = 'HPR',
		[source_asset_type] = 'Fibre',
		[destination_asset_type] = 'HPR'
		))
      ))
	+SELECT(rf_design[Destination Asset ID],
	AND(
	[lcs] = [_THISROW-2].[lcs],
      [main_asset_name] = [_THISROW-2].[select_cabinet_to_survey],
      [sub_asset_name] = [_THISROW-2].[sub_asset],
      [destination_asset_type] = [_THISROW-2].[select_asset_type],
      NOT([destination_asset_type] = 'Cabinet'),
    	NOT([_THISROW].[branch_info] = "computed"),
      NOT(
      		AND(
    		  LEFT([sub_asset_name], 3) = 'HPR',
			[source_asset_type] = 'Fibre',
			[destination_asset_type] = 'HPR'
			)),
      NOT(
      		AND(
          		[main_asset_name] = [sub_asset_name],
			[source_asset_type] = 'Fibre',
			[destination_asset_type] = 'HPR'
			))
      ))
    	),FALSE
	)),TRUE
	),[asset_name]
	)

	-SPLIT(survey[planned_asset_id], ",")
	-[branch_A_assets]
	-[branch_B_assets]
	-[branch_C_assets]
	-[branch_D_assets]
	-[branch_E_assets],

[survey_branch_number] > 1,

SPLIT(
	SELECT(
	survey[survey_asset_id],
  	AND(
	[survey_type] = "Cable",
	[LCS] = [_THISROW].[lcs],
	[select_cabinet_to_survey] = [_THISROW].[select_cabinet_to_survey],
	[sub_asset] = [_THISROW].[sub_asset],
    [select_asset_type] = [_THISROW].[select_asset_type],
    [survey_branch_number] = [_THISROW].[survey_branch_number],
    [branch_info] = "new branch"
    )),
    ","
    )

-SPLIT(
	SELECT(
	survey[planned_asset_id],
  	AND(
	[survey_type] = "Cable",
	[LCS] = [_THISROW].[lcs],
	[select_cabinet_to_survey] = [_THISROW].[select_cabinet_to_survey],
    [sub_asset] = [_THISROW].[sub_asset],
	[select_asset_type] = [_THISROW].[select_asset_type],
    [originating_branch] = [_THISROW].[survey_branch_number],
    NOT([branch_info] = "computed")
    )),
    ","
    )
    
    -[branch_A_assets]
	-[branch_B_assets]
	-[branch_C_assets]
	-[branch_D_assets]
	-[branch_E_assets]

    )

.
.
Cheers…

That’s a lot to digest. What do you need from me at this point?

Hi @Steve,

Agreed… Please ignore everything above… Starting over…

What I’m trying to do is invoke a “Data Validity” situation so that I can force an “Invalid Value Error” message (preventing a user from saving the form) until they select different form options that release the “Error Trigger”

For example:

If the result of an expression in [Column A] is <=0

Then [column B] should have a (Data Validity) “Invalid Value Error” message and prevent a user from saving the form until [Column A] is no longer <=0

I can deal with the expressions/conditions that create or resolve [Column A].

I’m having difficulty with [Column B]

Cheers…

Hi @Steve,

I think I’ve got it now.

It looks like I was making this more difficult than it needed to be.

Apologies for the wild goose chase…

I’ll go and apply this in my app now… Thanks for your time…
.
.
Error Not Triggered
3X_f_d_fd86ab840376568ff0a0ef1c7b30889b833e87f1.png

Error Triggered by [data] < 1
3X_6_f_6fb6f13aae204070c336a48e42aaa6cb3a19f652.png

[validity_checker] column

[data] column

Top Labels in this Space