Saubs Posted June 6, 2007 Posted June 6, 2007 Please forgive this newbie question, but I can't quite figure it out: I'm trying to use the GoToPortalRow[by calculation] script step to go to a row in which the value of relatedFieldXYZ (which is a field within the portal) is "foo". So, if the field in the third portal row contains "foo", go to row 3. Using Go to Portal Row [Line_Items::relatedFieldXYZ = "foo"] doesn't work, nor does a couple other things I've tried. How is this accomplished? Many thanks--
aldipalo Posted June 6, 2007 Posted June 6, 2007 Try this script it should work. Of course you need to make adjustments so it works for your needs. HTH
Saubs Posted June 6, 2007 Author Posted June 6, 2007 Thanks very much for your reply, aldipalo. Your suggestion works very well--except that I am allowing for the creation of related records in the portal, and therefore the 'exit after last' step creates a problem. Rather than 'exit after last', could I use an IF statement instead, something like... Exit the loop if the number of portal rows which contain data = Get(PortalRowNumber) What would the proper syntax be? Or, if you have a better suggestion I'd be happy to see it. Thanks again--
aldipalo Posted June 6, 2007 Posted June 6, 2007 I'm not sure I understand what you want to do. Is it that you are looking for a specific criteria within a specific field and "IF" it exists you want to make a new record? If so, then all you need to do is create a new record "If" YourField =whatever. In other words: If Your field = whatever New record request Pause/Resume Script Blah Blah Blah endif loop etc. You set up the loop to find the field data and then create the record. After the "If" is found you can do whatever you wish and then continue on. If I am not reading you correctly please explain further. Al
Saubs Posted June 7, 2007 Author Posted June 7, 2007 aldipalo, I apologize for not explaining this better. Actually your suggestion was just what I needed to solve my first issue. I then tried to apply it to help solve a second issue, and that's where I'm having a problem: My users need to control the order of how line items appear in a portal (think of a music playlist analogy), so I put a field called LineItems::PortalRowOrder in the portal. The portal is sorted by this field, so if my users enter the number '3' in this field, that row is displayed third from the top. I am trying to use the script which follows to tidy up the values after the user makes changes to LineItems::PortalRowOrder. My goal is that LineItems::PortalRowOrder always begins with '1' and ends with '##', with no missing integers in between. Am anticipating my users may leave it looking like this: 1 2 4 5 8 9 instead of 1 2 3 4 5 6 ...you get the idea. So here's my 'tidy it up' script: Go to Portal Row [ Select; First ] Set Field [ Line_Items::PortalRowOrder; Get ( PortalRowNumber ) ] Go to Portal Row [ Select; Next ] Loop Set Field [ Line_Items::PortalRowOrder; Get ( PortalRowNumber ) ] Go to Portal Row [ Select; Next ] Exit Loop If [ Max(Line_Items::PortalRowOrder) = Get ( PortalRowNumber ) ] End Loop Checking the 'Exit After Last' box doesn't work because I'm allowing the creation of related records in the portal. So I instead tried Exit Loop If [ Max(Line_Items::PortalRowOrder) = Get ( PortalRowNumber ) ] but that's not working reliably either. Beyond trying to fix this script, I'm also realizing this may be a clunky way of achieving my goal. What would be ideal is if a user could drag n drop a portal row from, let's say, the 8th row up to the 3rd row, and all the rows would move/shuffle to accomodate the change. I'm assuming that functionality is not available? Any other suggestions on how to accomplish my goal more elegantly would be appreciated. Is this technique known as 'dynamically sorting' or 'filtering' a portal? I would be happy to search for the solution on my own if I knew what search string to look for. Many thanks, all--
Recommended Posts
This topic is 6380 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 accountSign in
Already have an account? Sign in here.
Sign In Now