Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 4807 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I don’t know much about scripting and I’m getting crazy with this.

What I want to accomplish is to get related records of related records but when I get the related records of the first related record I can’t come back to the second "first" related record. Sounds weird :shocked:

I got months that has many exams that has many answers.

I want the questions to be listed first and then the questions and it’s answers, like

1. Question...

2. Question...

3. Question...

---

1. Question...

a) Answer...

b )Answer...

c) Answer...

2. Question...

a) Answer...

b )Answer...

c) Answer...

Everything goes fine but I can’t come back from the answers of question one to go on on the second question.

This is my script and where I get lost.

Go to Related Record [ From table: "T013c_Exams"; Using layout: "L013c_Exams" (T013c_Exams) ]

[ Show only related records ]

Sort Records [ Specified Sort Order: T013c_Exams::Number; ascending ]

[ Restore; No dialog ]

Go to Record/Request/Page

[ First ]

#----Questions

Loop

Set Variable [ $Questions; Value:$Questions & "¶" & TextStyleAdd ( T013c_Exams::Number ; Bold ) & " " & T013c_Exams::Text & "¶"

-FROM HERE-

#----AnswersByQuestion

Go to Related Record [ From table: "T013c1_Answers"; Using layout: "L013c1_Answers" (T013c1_Answers) ]

[ Show only related records ]

Sort Records [ Specified Sort Order: T013c1_Answers::Number; ascending ]

[ Restore; No dialog ]

Go to Record/Request/Page

[ First ]

Set Variable [ $Answer; Value:"" ]

Loop

Set Variable [ $Answer; Value:$Answer & T013c1_Answer::Number & " " & T013c1_Answer::Text ]

Go to Record/Request/Page

[ Next; Exit after last ]

End Loop

-TO HERE-

Set Variable [ $QuestionsAndAnswers; Value:$QuestionsAndAnswers & "¶" & TextStyleAdd ( T013c_Exams::Number ; Bold ) & " " & T013c_Exams::Text & "¶" & $Answer ]

Go to Record/Request/Page

[ Next; Exit after last ]

End Loop

Thank you very much for your help.

Posted

Well you need a

Go to Layout "L013c_Exams"

at the -TO HERE- mark. This layout will be in the same state you left it, so it will just continue as you want it to.

Posted

First of all, thank you very much for your help.

I was very near but I was using Go to Related Record instead of Go to Layout.

It works fine, but I have found another problem I wasn't aware of.

It works fine only if all questions have answers (related record) if a question doesn't it stops there and the script gives wrong data.

Thanks again.

Posted

I can't believe it :laugh2: I think I have solved it.

In exams table made a field, answered yes-no, and right before going to the answers put an If [T013c_Exams::Answered = "Yes"] and the End If right after the next End Loop, and It Works!!!!!!

FM rocks, I wish I'd have more knowledge of it, but step by step.... as a script :hmm:

This topic is 4807 days old. Please don't post here. Open a new topic instead.

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.