Author Topic: I-Descriptor syntax in SB+  (Read 5866 times)

slestak

  • Uber-Pro
  • ****
  • Posts: 77
I-Descriptor syntax in SB+
« on: June 27, 2012, 08:46:38 AM »
Mecki Forthmann had this tip on the mailing list long ago but it recently saved me lots of heartache.  Wanted to share it in case someone else could use it.

You can wrap I-descriptor syntax in an I() in SB+ FD's.

I(TRANS("SHIP.TO.STAT",@ID,11,"X");FIELD(@1,@VM,1,12);SUM(@2))

Tom Pellitieri

  • Rock Star
  • *****
  • Posts: 224
  • Tom Pellitieri - Toledo, Ohio
Re: I-Descriptor syntax in SB+
« Reply #1 on: June 28, 2012, 08:02:56 AM »
Wow... that certainly saves a lot of SB Process calls! 

I wrote a paragraph to sum selected values from a MV attribute.  It's not easy to use because you have to specify all the parameters correctly.  It's slow because it's a paragraph call for a /FD, plus it uses a FOR loop.

Thanks for posting this solution!

--Tom

slestak

  • Uber-Pro
  • ****
  • Posts: 77
Re: I-Descriptor syntax in SB+
« Reply #2 on: August 14, 2012, 12:43:12 PM »
I have found a potential Gotcha regarding this solution.

I used an I(SUBR()) to add a field to a ReportWriter report, and some unibasic code in its Process After Read killed the result of my FD.  It is a very weird issue.  My SUBR that I called does not use any COMMON, any WORK vars, very simple.  And it works 90% of the time, but I traced it and about the 10th line into the Process After Read program, it does a DCOUNT of a dyn array, and merely executing that makes a totally unrelated FD return nothing.

If I RETURN from the P.A.Read subroutine the line before the DCOUNT() then my other FD works like a champ, 100%.

This is completely reproducible.
« Last Edit: August 14, 2012, 12:44:51 PM by slestak »

slestak

  • Uber-Pro
  • ****
  • Posts: 77
Re: I-Descriptor syntax in SB+
« Reply #3 on: August 15, 2012, 02:31:23 PM »
I received more information from a friend (thanks BV!).

I did not have anything in my F6 OR Derived Field, so I needed to have two versions of my subroutine.  One that is SB+ compliant with a B() expression returning @VALUE and a second subroutine that is Unibasic TCL compliant.

Aggravating.  Appears to work in all places now.

Chris Weitzel

  • Professional
  • ***
  • Posts: 30
Re: I-Descriptor syntax in SB+
« Reply #4 on: August 17, 2012, 07:40:43 AM »
Thanks for the info.  Reading through this led me to a solution for a problem.  That's why I love this forum!

-cw