cancel
Showing results for 
Search instead for 
Did you mean: 
SOLVED

Node-Red Datalayer to CSV on USB

Node-Red Datalayer to CSV on USB

NThompson002
Member

Hello forum. I am a bit outside my wheelhouse. Trying to create a data collecting system so I can log data from a test stand that we are building for a customer. I have attached the flow I have so far. (Understanding I am probably doing this the "hard way" due to my lack of experience on this side of things. I am a CoDeSys guy lol). I have successfully setup the Device Bridge app to get my data from the two diverent XM22 PLC's. I have successfully created and/or appended a CSV file on a Mounted USB Stick on the CORE. The part that I can't figure out is why the tag data is not being written to the CSV file. I can used the Debug node to see the correct data in the payload up until the final CSV step. the output after the CSV is just comma's. I know it has to be simple but I am just not seeing what is wrong or how to fix it.

Have to change the extension to .json if you want to import.

 

2 REPLIES 2

nickH
Community Moderator
Community Moderator

Hello @NThompson002 

After your join-node, where you join all the Data Layer Reads together in one payload, you will get a payload similar to this:

msg.payload after joinmsg.payload after join

 

msg.payload = {msg1.topic : msg1.payload, msg2.topic : msg2.payload, ...}

The values you get as the identifier for the payloads (the topics from the single reads) have to match with the columns you have in your csv node. In my case that would be: sdk-cpp-registernode/myFloat, sdk-cpp-registernode/myInt64, sdk-cpp-registernode/myString.

Colums in CSV nodeColums in CSV node

 

You could also think of changing every msg.topic after the single Data Layer Read nodes, so you will get better readable columns. 

Best regards, 

Nick

So if I am understanding it correctly... the CSV node uses the key object (which is the topic in this case) as the column names and if they do not match, the data will not be written correctly?

Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist