Join The Works program to have access to the most current content, and to be able to ask questions and get answers from Revelation staff and the Revelation community

At 10 MAR 2005 10:38:22AM Charlie Engler wrote:

I hope I can clearly explain my problem so here goes….

I have tons of code in AREV in which I use the Insert command to append data to mv fields in a record as follows:

 @RECORD=INSERT(@RECORD,1,-1,0,Var1)
 @RECORD=INSERT(@RECORD,2,-1,0,Var2)
 Etc...

At times, one of the variables does not contain data. In AREV, the Insert command would still insert an @VM and all fields would contain the same number of @VM's. Life was good in those days.

Now, I'm coverting from AREV to OI. I am again trying to use the same code but noticed that if a variable that does not contain data is passed to the Insert command, an @VM is no longer inserted in that field and the number of @VM's is not the same in all the fields.

I end up with a record as follows:

   Field1   Value1 @VM Value2 @VM Value3 @VM Value4
   Field2   Value1 @VM Value3 @VM VAlue4
   Field3   Value1 @VM Value2 @VM Value3 @VM Value4

In the above example, Value2 in Field2 did not contain data and therefor the Insert did not add an @VM for that position. When I loop through the data later, the positions will be mismatched.

I know I can work around this by using the format Field=Field:@VM:NewValue, but this would require a lot of unnecessary code changing and seems like a step backwards.

Perhaps I'm missing something here but it seems like the Insert command should still be able to accept an empty variable passed to it and still append an @VM in the proper place.

Thanks in advance for any advice.


At 10 MAR 2005 10:56AM John Bouley wrote:

Charlie,

Are you sure it is the insert command or is it the save of the data by the form. We have found that if a field that is part of an associated mv array is saved by a bound form the save process strips any extraneous vms. Having said that if a value is added it will save the data at the correct level.

I would change your code to be as follows.


pos=count(master_amv,@vm) + (master_amv ne ) + 1 master_amv=newdata1 field2=newdata2 field3=newdata3 —- so instead of using an insert you calculate the next number and always replace. HTH, John </QUOTE> —- === At 10 MAR 2005 11:06AM Colin Rule wrote: === <QUOTE>Yes, the Insert does not insert empty values. This as far as I know, is known and written that way. Perhaps not compatible with Arev, but it is by design. Johns suggestion is the best solution, and is how I do such things too. Colin </QUOTE> —- === At 10 MAR 2005 01:15PM John Bouley wrote: === <QUOTE>Also, I checked AREV and it also will not Insert null values so AFAIK this behavior hasn't changed. </QUOTE> —- === At 11 MAR 2005 06:01AM support@sprezzatura.com wrote: === <QUOTE>We ran a quick program in AREV 3.12 and OI 7.1: <code> A=' A=INSERT( A, 1, -1, 0, 'A' ) A=INSERT( A, 1, -1, 0, )

A=INSERT( A, 1, -1, 0, 'C' )

A=INSERT( A, 1, -1, 0, ) A=INSERT( A, 1, -1, 0, 'E' ) </code> which gave A a value of <code> A²²C²²E </code> as expected. support@sprezzatura.com The Sprezzatura Group Web Site World Leaders in all things RevSoft </QUOTE> —- === At 11 MAR 2005 11:41AM Warren Auyong wrote: === <QUOTE>Try this: A=' A=INSERT(A,1,-1,0,)

A=INSERT(A,1,-1,0,'B')

A=INSERT(A,1,-1,0,) A=INSERT(A,1,-1,0,'C') A=INSERT(A,1,-1,0,)


At 11 MAR 2005 11:52AM Warren Auyong wrote:

Even more dramatic:

A='

FOR I=1 TO 4

A=INSERT(A,1,-1,0,) NEXT I A=INSERT(A,1,-1,0,'F') As far as I recall this is normal behavior for every MV system (Pick) that I've used. Never use the -1 insert if nulls are involved. </QUOTE> —- === At 11 MAR 2005 12:03PM Warren Auyong wrote: === <QUOTE>If recall the rational behind this is as such A=' A=INSERT(A,1,-1,0,)

If a @VM was appended and you did a COUNT(A,@VM) + (A NE ) you would be led to believe the data count was two. Also if you did A EQ you would get the results you expected, but if you did A EQ '' you would not.

View this thread on the Works forum...

  • third_party_content/community/commentary/forums_works/5da9ee23bb6c25cc85256fc00055e927.txt
  • Last modified: 2024/01/04 20:57
  • by 127.0.0.1