# Convert var to string, and string to element Dynamo

**URL:** https://forum.dynamobim.com/t/convert-var-to-string-and-string-to-element-dynamo/51339
**Category:** Revit
**Tags:** excel, dynamo
**Created:** [June 2, 2020, 9:04pm UTC](https://forum.dynamobim.com/t/convert-var-to-string-and-string-to-element-dynamo/51339 "2020-06-02T21:04:30Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![GJax89](https://avatars.discourse-cdn.com/v4/letter/g/5daacb/32.png) [@GJax89](https://forum.dynamobim.com/u/GJax89)
#### Post date: [June 2, 2020, 9:04pm UTC](https://forum.dynamobim.com/t/convert-var-to-string-and-string-to-element-dynamo/51339/1 "2020-06-02T21:04:30Z")

</div>

Hi All,

So I am trying to pull data from excel into Dynamo, to update/create line styles.  
It falls apart at the node “LineStyle.Create”, and kicks the following error:  
“Warning: Internal error, please report: Dereferencing a non pointer. Internal error please report: Dereferencing a non-pointer  
LineStyle.create expects argument of type(s) (string, int, Element, Color), but was called with (var, int,string, DSCoreColor).”

I can’t seem to figure out how to convert my list to a string, I don’t want it to have a suffix or separator, (at least not as far as I know) or how to convert my string into an element. I’m at a loss. Any ideas?

[LineStyleCreation.dyn](https://forum.dynamobim.com/uploads/short-url/hlJEXKbzMP0SlRT4HdXi2nScQS6.dyn) (136.3 KB)

 ![Annotation 2020-06-02 165336](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/0/70c76e2be52d1aaa49c83e03b47600f1c1efad93.png)

Edited for typos

---

<div class="post-metadata">

### Author: ![Kulkul](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kulkul/32/49801_2.png) [@Kulkul](https://forum.dynamobim.com/u/Kulkul)
#### Post date: [June 3, 2020, 6:46am UTC](https://forum.dynamobim.com/t/convert-var-to-string-and-string-to-element-dynamo/51339/2 "2020-06-03T06:46:35Z")

</div>

Hi @GJax89

Error says you need to connect LinePattern Element but you’re connecting it as String:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/9/99dec7a8ec82fe4772ffced0599047c66666abb7.png)  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/6/16a43edbce0bb9d47cc06989c8cf0bc4d36dcc71.png)

---

<div class="post-metadata">

### Author: ![GJax89](https://avatars.discourse-cdn.com/v4/letter/g/5daacb/32.png) [@GJax89](https://forum.dynamobim.com/u/GJax89)
#### Post date: [June 3, 2020, 1:30pm UTC](https://forum.dynamobim.com/t/convert-var-to-string-and-string-to-element-dynamo/51339/3 "2020-06-03T13:30:09Z")

</div>

Hello @Kulkul

Bimorphnodes claims this can be done with lists to batch create:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/7/4712bcc337719858510f20024c661eecf45af3e2.jpeg)  
This is what I am trying to accomplish, Can this only be done with manual text entry in a code block, or is it possible to convert my string into a list for this purpose? I already have the names, and line patterns in string form, I am trying to convert them to something the node will read as intended.  
My goal is to create these as a batch.  
So how can I convert what is being called as a var to a string, and a string to element names, if at all?

---

<div class="post-metadata">

### Author: ![Kulkul](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kulkul/32/49801_2.png) [@Kulkul](https://forum.dynamobim.com/u/Kulkul)
#### Post date: [June 3, 2020, 1:49pm UTC](https://forum.dynamobim.com/t/convert-var-to-string-and-string-to-element-dynamo/51339/4 "2020-06-03T13:49:14Z")

</div>

> [@GJax89](#):
>
> My goal is to create these as a batch.  
> So how can I convert what is being called as a var to a string, and a string to element names, if at all?

Could you post your rvt and excel file here? I will show you how.

---

<div class="post-metadata">

### Author: ![GJax89](https://avatars.discourse-cdn.com/v4/letter/g/5daacb/32.png) [@GJax89](https://forum.dynamobim.com/u/GJax89)
#### Post date: [June 3, 2020, 2:37pm UTC](https://forum.dynamobim.com/t/convert-var-to-string-and-string-to-element-dynamo/51339/5 "2020-06-03T14:37:53Z")

</div>

Sure!

[TESTPROJ.rvt](https://forum.dynamobim.com/uploads/short-url/oiNJKUSnDEOvuU1mUQYhPPlYYCM.rvt) (3.4 MB)  
[Linetypesfromtemplate.xlsx](https://forum.dynamobim.com/uploads/short-url/AvoVpKNM5nI6tpGu7DMPkHtJXr2.xlsx) (9.7 KB)

---

<div class="post-metadata">

### Author: ![Kulkul](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kulkul/32/49801_2.png) [@Kulkul](https://forum.dynamobim.com/u/Kulkul)
#### Post date: [June 3, 2020, 5:22pm UTC](https://forum.dynamobim.com/t/convert-var-to-string-and-string-to-element-dynamo/51339/6 "2020-06-03T17:22:17Z")

</div>

Try this:  
[LineStyleCreation\_For Greg.dyn](https://forum.dynamobim.com/uploads/short-url/8VCrC83zaa5C7iywstKoXdVlBVx.dyn) (151.1 KB)

---

<div class="post-metadata">

### Author: ![GJax89](https://avatars.discourse-cdn.com/v4/letter/g/5daacb/32.png) [@GJax89](https://forum.dynamobim.com/u/GJax89)
#### Post date: [June 3, 2020, 6:27pm UTC](https://forum.dynamobim.com/t/convert-var-to-string-and-string-to-element-dynamo/51339/7 "2020-06-03T18:27:18Z")

</div>

Hi @Kulkul

That doesn’t kick an error, But if I try to add a new type to the list, it does not get created in a project. Am I missing something? I really appreciate all your help!

Edit: To clarify I mean if I add data to the excel file in the same formatting

---

<div class="post-metadata">

### Author: ![GJax89](https://avatars.discourse-cdn.com/v4/letter/g/5daacb/32.png) [@GJax89](https://forum.dynamobim.com/u/GJax89)
#### Post date: [June 11, 2020, 3:05pm UTC](https://forum.dynamobim.com/t/convert-var-to-string-and-string-to-element-dynamo/51339/8 "2020-06-11T15:05:28Z")

</div>

Hey, the script returns Null for 32/34 items. I am trying to get this to work, any ideas? Apologies for the delay, Work caught up with me.
