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

Getting a field name in a portal


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

Recommended Posts

Posted

Hi all.

I need help from those wiser than me.

I have a field in a portal. I would like to determine its name and wether it is empty or not. I have set up a script parameter that returns the portal row but how can I get the name of the field. There are 3 fields on the portal and Get activefield name does not return any values (resumably because the field is not actually active)

Any advice?

Joseph

Posted

Well, Joseph, field names aren't typically a mystery to the developer, lol. Perhaps you can step back and tell us the goal and then we can suggest the technique to achieve it.

Posted

Yes I guess the post was a bit vague.

I have a layout with 10 portals on it. within each portal row there are 3 fields. One of those fields is set up as a button so that a script is triggered when clicked on.

The problem is that the script that runs is different depending on which field is selected.

What I would like to accomplish is a means of determining which field has been clicked on (and in which portal) to run ONE script as opposed to writing 10 different scripts, one for each portal

Joseph

Posted

That's what a script parameter is for; instead of sending the portal row number, send up a value that uniquely identifies the portal (or the field, if necessary). This could be an arbitrary value, such as "A1" for field 1 in the first portal.

  • Like 1
Posted

I already use the script parameter in determining the portal. Then I use Go to Portal Row(Get ScriptParameter).

The problem is that in portal 1 I have a field called appointments1 and the second portal I have appointments2 etc. My script needs to determine wether this field is empty or not. Thus I can use If is empty(Appointments1) but would have to rewrite the script for every portal. What I would like to do is something like if is empty(appointmsntsX). But how can I retrieve the field name?

Posted

I already use the script parameter in determining the portal.

I don't think you do. If you can use Go to Portal Row [ Get (ScriptParameter) ], then your parameter contains the portal row number - not anything about which portal to use.

I would also question why you have numbered fields like Appointments1 and Appointments2 - that's almost always a symptom of inadequate structure.

Posted

I suspect that I do have an inadequate structure but I don't know another approach to this.

Essentially I am trying to display 10 portals on one layout which represent the appointments of 10 different doctors.

I have a match field to my appointments table using doctorID. Thus I have 10 different relationships and therefore in the first relationship to the appointments table it is appointment1 and to the second relationship appointments2 etc.

How else could I do this?

Posted

therefore in the first relationship to the appointments table it is appointment1

I am afraid I don't follow. Why would there be different fields in each portal? You also didn't say what your script does - I am getting a feeling it could be a lot simpler than you're trying to make it. Note that while you are in a portal, a reference to a related field is a reference to a field in the current row.

Posted

OK

I have three tables:

•Doctors

•Calenderview

•Appointments

Calendarview is related to appointments via a global field in calenderview that derives its values from Doctors, and doctorID in appointments.

That way setting a given doctor in the global will show all his appointments.

As there are many doctors I have set up a layout that shows ten portals each will display a different doctor.

I have set up 10 globals and each can have a different doctor. I therefore need multiple table occurrences of appointments.

So each table occurrence is labeled appointment1, appointments2 etc.

In the appointments table occurence I would like to click a given entry (which is set up as a button) This runs a script which determines wether the field in that particular portal row is empty or not.

The only way I know to do that is to use something like If (field in appointments1) is empty. But that means that i have to write a script for each portal which is my problem

Joseph

  • Newbies
Posted

Have the buttons on the layouts pass the record ID of the Appointment rcd. In your script, open a new window and change to a layout that is based on Appointment. Find the record using the script parameter. Now you can testing if <thatfield> is empty or not and do what you need to do.

Think of the new window as the data entry screen, and your 10-portal layout as your schedule viewing screen.

Posted (edited)

In the appointments table occurence I would like to click a given entry (which is set up as a button) This runs a script which determines wether the field in that particular portal row is empty or not.

I am still not sure I follow your description. As I said in my previous post, you can check the value of a field in the clicked row (or another field in the same related record) directly. If you have multiple portals with different TO's, and you want to use the same script, you can use script parameter to identify the TO - see a simplified example attached.

TObyParameter.fp7.zip

Of course, this wouldn't be necessary if you used filtered portals with a single TO.

Have the buttons on the layouts pass the record ID of the Appointment rcd. In your script, open a new window and change to a layout that is based on Appointment. Find the record using the script parameter.

Wouldn't GTRR do the same thing, with considerably less effort?

Edited by comment
Posted

Of course, this wouldn't be necessary if you used filtered portals with a single TO.

What an idea. I am not sure how to do a filtered portal. Can you direct to more info on this?

Posted

Just started playing with this portal filtering. Very exciting idea.

Hit a snag though.

In my solution I have a table called Diary which has a cartesian relation to Calenderview. This is because calenderview has time slots from 8am to 8pm. That way the time slot fields are always visible.

Calenderview is in turn related to appointments via a DoctorID.

I have set up the portal filter to only display fields in the portal when gDoctorID in calender view = DoctorID in appointments. Problem is that the time slots are no longer visible.

How can I get around this? How can I get the time slots to always appear?

Joseph

Posted

Have the buttons on the layouts pass the record ID of the Appointment rcd. In your script, open a new window and change to a layout that is based on Appointment. Find the record using the script parameter. Now you can testing if <thatfield> is empty or not and do what you need to do.

Think of the new window as the data entry screen, and your 10-portal layout as your schedule viewing screen.

Problem is that although I can get to the layout, there are multiple fields there. I therefore still have to direct the script to a particular one

Joseph

Posted

In my solution I have a table called Diary which has a cartesian relation to Calenderview. This is because calenderview has time slots from 8am to 8pm. That way the time slot fields are always visible.

Calenderview is in turn related to appointments via a DoctorID.

I am afraid it's clear as mud. :smile:

If you are using slots, and say you want to show 12 slots per day x 10 doctors; that means you will need 120 records in the Slots table, and 10 side-by-side portals to the Slots table - using the same TO of Slots table over and over, with the second portal starting at row 13, the third portal at row 23, etc.

For any new doctor, you need to add 12 records to the Slots table, and another 12-row portal to the layout.

Posted

To clarify

In the diary table there is a portal to calenderview. Calender view has records which are time slots related via a cartesian relationship. That way all time slots show whether there is an entry or not. In the same portal I can see the appointments field. The advantage is that I can see all time slots, some with entries and some empty.

If I did n't do it that way then only time slots with entries would be visible making the empty time slots difficult to see.

The problem is that when I filter the portal I lose the time slots.

Posted

Calender view has records which are time slots related via a cartesian relationship. That way all time slots show whether there is an entry or not.

Yes, that is what I described in my previous post. However, in this situation you do NOT need 10 TOs of ... well, any one table. And no filtering either.

  • 2 weeks later...
Posted

I am afraid it's clear as mud. :smile:

If you are using slots, and say you want to show 12 slots per day x 10 doctors; that means you will need 120 records in the Slots table, and 10 side-by-side portals to the Slots table - using the same TO of Slots table over and over, with the second portal starting at row 13, the third portal at row 23, etc.

For any new doctor, you need to add 12 records to the Slots table, and another 12-row portal to the layout.

Sorry for the delay in responding.

I don't think that I grasped what you are saying here.

Can you please elaborate

Joseph

Posted

Thank you very much for all you're effort I really appreciate it.

I'm slowly getting it (remember I am a relative beginner)

2 questions:

I can see how the script determines wether the slot is empty or not. So if I want to add a new appointment where would I enter it? In the slots table or the appointment table?

Can you explain how the calculation field works

Joseph

Posted

if I want to add a new appointment where would I enter it? In the slots table or the appointment table?

In the Appointments table, of course. The slots are there only to display the appointments in "grid".

This topic is 4511 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.