June 6, 200718 yr 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--
June 6, 200718 yr Try this script it should work. Of course you need to make adjustments so it works for your needs. HTH
June 6, 200718 yr Author 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--
June 6, 200718 yr 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
June 7, 200718 yr Author 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--
Create an account or sign in to comment