Jump to content


Photo

Append Function Not Working?


  • Please log in to reply
4 replies to this topic

#1 JohnyQuick

JohnyQuick

    Advanced Member

  • Members
  • PipPipPip
  • 76 posts

Posted 24 February 2012 - 01:49 PM

Hi Again!

I need to create some arrays, from other arrays. I used the append function and in worked fine so that

example array E {1,2,3,4...}

then D.append(E[0]) makes array D {4,3,2,1...}

But, When I try to do the same append, with say array F and H, or I and J, The append function doesn't work, and I get


"C1040 Channel does not have any valid values" for the line in the sequence that uses the append function.

This error happens even when I use the same arrays as E and D, redefined into F and H.

I know the arrays have valid values, because I see them propagate fine using channels E and D, but not with F and H. Also, using the exact same arrays that worked for channels E and D, do not work with the append function for F and H. I have tried renaming channels, and searched the document to see if there are already channels, or variables with the same name, but that isnt the problem either.

What is up with the append function? What is going wrong. Ive spent 3 days on this so far. :rolleyes:

#2 AzeoTech

AzeoTech

    Guru

  • Administrators
  • PipPipPipPipPip
  • 4529 posts

Posted 27 February 2012 - 11:09 AM

I'm guessing that your arrays are not actually called D, E, F, H, I or J and most likely some of these use reserved words. Its possibly something else, but I'd really need to see a .ctl file demonstrating what you are seeing to address the reasons.

#3 JohnyQuick

JohnyQuick

    Advanced Member

  • Members
  • PipPipPip
  • 76 posts

Posted 23 August 2012 - 05:42 PM

Im still not getting this. My arrays are called D and E, yes really. D is a backwards array of E. Both are channels. I can use D to make the second array, which I deperately need.

Well , so what is a "reserved" word? And How is that the conflict?

Here is some code from the sequence that wont go.

waitfor (((dpth[0]-one_ft_dpth[0]) >=1),1) // put in one_ft_rop sequence!! **change>1 to >2 or.5*********
//*****************************************************************4-26-2012**************
// J= one_ft_dpth[0] // Set Variable to 1,2 or 5 in above line for 1'.2' or5'fph drillrates
// E=RefVol+(((Dpth[0])-(Reflagdpth))*Annvolft)+Barrels
E=(lagvol+Barrels) // omit 2 lines for 2' and 5' ROP
delay(1)
D.Append(E[0])
D.APPEND(one_ft_dpth[0]) // D =SAME AS E ARRAY, BACK TO FRONT!!!!!!!!
delay(1)

// LagDepth.APPEND(one_ft_dpth[0])
// LagDepth[numrows(one_ft_dpth)]=lagdepth[0]
//LagDeep.APPEND(One_Ft_Dpth[0])
try // Append(LagDepth,one_ft_dpth[0])

T3=gettime(ONE_FT_Dpth[0])

***************************************************************************************************************************************************8

For whatever reason, The LagDepth Channel wont append like the D channel will.

The D.Append works fine -The D channel appends-no problem

The Trick is to have an array-back to front of Depth, the future Lag Depth, that gets removed in another sequence, to evaluate the Lag Depth, when it is "Lagged Up"

Any Help Please?

#4 AzeoTech

AzeoTech

    Guru

  • Administrators
  • PipPipPipPipPip
  • 4529 posts

Posted 23 August 2012 - 09:38 PM

A reserved word is a word used by the language itself, like "while" and "for" and "sin" and "cos".

You can't use append() with a channel. You should use addValue(), which doesn't really do the same thing. The thing about channels is that you can only stick data at the top, and you can't edit values already there. This is against the whole notion of data integrity. If you need to do that sort of manipulation, you should use variables instead.

Also, if you just need to reverse an array, you can use sortTime() to do it:

reverseX = sortTime(insertTime(x, 0, 1))

#5 JohnyQuick

JohnyQuick

    Advanced Member

  • Members
  • PipPipPip
  • 76 posts

Posted 24 August 2012 - 03:38 PM

Thank You !! That was the trick, because somewhere in my maze of sequences D was declared a variable, but I also had it as a channel. All that was needed was a new Global Variable. This will improve my lag depth sequences 10-fold! :)