DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a new channel in the data portal of type String/Text?

Solved!
Go to solution

I was looking for a way to store the names of the channels coming from my database --> to the channel, but its not working.
I tried something like this:

set oChnXname = data.Root.ChannelGroups("Exp Channel group").Channels.Add("ChnXname",Datatypestring)

oChnXname(i)=(RS.fields("xchannel"))

Any help is highly appreciated


Thanks in Advance.

0 Kudos
Message 1 of 7
(2,469 Views)

You create a new channel oChnXname.  What is the value of "i"?  If it is 0 that won't work.  Also, nee to use oChnXname.Values(i).  Also, no idea what RS object is.

0 Kudos
Message 2 of 7
(2,453 Views)

'i' is:
i=1 to rowcount(RS) ' RS is the record set obj for the data coming from DB

0 Kudos
Message 3 of 7
(2,436 Views)

Possible reasons why doesn't work:

1. You use channel(i) instead of channel.Values(i)

2. (RS.fields("xchannel")) is not returning you a String type.  Try converting it to String.

3. (RS.fields("xchannel")) is empty

It is hard to know what the exact issue is since you haven't showed an error message or wrong output of your existing script

Message 4 of 7
(2,431 Views)

I tried:

oChnLimit.Values(i)=(RS.fields("limit"))

and it throws this errordiadem trial.png

 

1. tried
2. data in the database is of varchar type, so i used data type string while creating channel

set oChnLimit = data.Root.ChannelGroups("Exp Channel group").Channels.Add("ChnLimit",Datatypestring)


3. no, its not empty

0 Kudos
Message 5 of 7
(2,423 Views)
Solution
Accepted by topic author Kandukuri_raghavendra

yes so the error message says that you are trying to put a vbObject into the string channel you created.  You must have some sort of loop to assign each value from RS (table?) to a value in your new channel

Like:

If not RS.EOF Then
  RS.MoveFirst
  Do While not RS.EOF
    Call LogFileWrite(RS.Fields("limit"))
    RS.MoveNext
  Loop
End If

Will that log strings?  or do you need to do something like RS.GetString?

Message 6 of 7
(2,416 Views)

Not sure if i need to log strings , but i tried to assign it to a temporary variable and then assigned that to obj, channel is referring to and it worked out.

   Dim tempA
            tempA=RS.fields("xchannel")
            oChnXname(i)=tempA

 

0 Kudos
Message 7 of 7
(2,403 Views)