Append Function Not Working?


JohnyQuick

Recommended Posts

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:

Link to comment
Share on other sites

  • 5 months later...

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?

Link to comment
Share on other sites

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))

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.