Https://bigfix.me/relevance/details/3008616

https://bigfix.me/relevance/details/3008616

I am trying to use above BigFix.me relevance in parameter to generate duration for xml but dont know why its giving relevance error.

Command succeeded parameter "StartDuration"="2 days, 13:02:38"
Command succeeded parameter "EndDuration"="4 days, 13:02:38"
Command failed (Relevance substitution failed) parameter "StartScheduleTime"="{(format "P(0)DT(1)H(2)M(3)S" + it / (1*day) of it + it mod (1*day) / (1*hour) + it mod (1*hour) / (1*minute) + it mod (1*minute) / (1*second) ) of ("(parameter "StartDuration")" as time interval)}"
Command failed (Relevance clauses must be surrounded by { and } guards.) parameter "StartScheduleTime"="{(format "P(0)DT(1)H(2)M(3)S" + it / (1*day) of it + it mod (1*day) / (1*hour) + it mod (1*hour) / (1*minute) + it mod (1*minute) / (1*second) ) of ("(parameter "StartDuration")" as time interval)}"

The syntax of the format command is wrong. It needs curly { and } braces not ( and )

Q: (format "P{0}DT{1}H{2}M{3}S" + it / (1*day) of it + it mod (1*day) / (1*hour) + it mod (1*hour) / (1*minute) + it mod (1*minute) / (1*second) ) of ("2 days, 13:02:38" as time interval)
A: P2DT13H2M38S

You may still have a challenge there though as curly braces within relevance substitution that is defined by the relevance statement within curly braces…you may need to escape each } as }} to stop them from being treated as the end of the relevance substitution.

Yes, you are correct ! I placed them for a purpose however I already tested it with escape {{ like below but failed.

Command succeeded parameter "StartDuration"="2 days, 13:02:38"
Command succeeded parameter "EndDuration"="4 days, 13:02:38"
Command failed (Relevance substitution failed) parameter "StartScheduleTime"="{(format "P{{0}DT{{1}H{{2}M{{3}S" + it / (1*day) of it + it mod (1*day) / (1*hour) + it mod (1*hour) / (1*minute) + it mod (1*minute) / (1*second) ) of ((parameter "StartDuration") as time interval)}"
Command failed (Relevance clauses must be surrounded by { and } guards.) parameter "StartScheduleTime"="{(format "P{{0}DT{{1}H{{2}M{{3}S" + it / (1*day) of it + it mod (1*day) / (1*hour) + it mod (1*hour) / (1*minute) + it mod (1*minute) / (1*second) ) of ((parameter "StartDuration") as time interval)}"

Did you try escape the trailing } as }}.? The single } may be causing it to interprets the first } as the end of relevance substitution.

yup, tried -
Command succeeded parameter “StartDuration”="2 days, 11:19:00"
Command succeeded parameter “EndDuration”="4 days, 11:19:00"
Command failed (Relevance substitution failed) parameter “StartScheduleTime”={(( format “P{{0}}DT{{1}}H{{2}}M{{3}}S” + it / (1day) of it + it mod (1day) / (1hour) + it mod (1hour) / (1minute) + it mod (1minute) / (1*second) ) of ((parameter “StartDuration”) as time interval))}

Might be its not possible to do it with a parameter. Parsing the time interval as a string instead of a parameter seem to work ok but using the same syntax on the parameter values gets an error.

parameter "Test" = "{(format "P{0}}DT{1}}H{2}}M{3}}S" + it / (1*day) of it + it mod (1*day) / (1*hour) + it mod (1*hour) / (1*minute) + it mod (1*minute) / (1*second) ) of ("2 days, 13:02:38" as time interval)}"

I think we are missing something, if its working in QNA it should be working in action script, that should not make any difference :frowning:

Ahh, here ya go

parameter "StartDuration"="2 days, 13:02:38"
parameter "EndDuration"="4 days, 13:02:38"
parameter "StartScheduleTime"="{(format "P{0}}DT{1}}H{2}}M{3}}S" + it / (1*day) of it + it mod (1*day) / (1*hour) + it mod (1*hour) / (1*minute) + it mod (1*minute) / (1*second) ) of ((parameter "StartDuration") as time interval)}"
1 Like

what was the missing piece !!! :slight_smile:

It was the quotes

of ("(parameter "StartDuration")"

should be

of ((parameter "StartDuration")

2 Likes

ahh but thats strange I tried this or could be missed !!! coz I were doing lots of tweaks in & out :slight_smile:

but Many thanks

A combination of the quotes but it was mainly the escaping the trailing curly braces on the format command to avoid them ending the relevance substitution :wink:

1 Like