Get record column1 that is not Null and output in Column2
Hi, Dataverse experts,
I am new to Dataverse and Python and encounter some problems with a simple script. I have a list of missing records. I'm trying to fill the gaps with the value of the previous row.
Can someone take the time and help me out?
I'm looking for a way to get the record in column1 that is not Null and to output it in the second column to the point there is a value in column1. Column1 (row 1) to output to Column test row (1 to 5) and the record in Column1 (row 6) to output to Column test row (6 to 10). My code so far:
if fields.Date is not Null:
out1.test= fields.Column1
else:
out1.test = 1 (this needs to be the value in column1) .
Thanks in advance Dino
-
You could use the following code in a Transform node (it assumes your input field and output field are both string data types as per your screenshot and defaults to using 1st January 1900 if the first record has a Null value):
#### ConfigureFields property script
out1 += in1
out1.test = str#### ProcessRecords property script
if node.firstExec:
previousValue = '1900-01-01'if fields.Column1 is not Null:
out1.test = fields.Column1
previousValue = fields.Column1
else:
out1.test = previousValue -
Hi Dino,
The second sample code snippet in the ProcessRecords script of the Transform node includes an example of using the node.Exec() method.
I believe there was an issue with the link to the online version of the help for a short while that has been resolved. The online help documentation is for the server also covers the Python scripting topics and is available here.
Regards,
Adrian
Please sign in to leave a comment.
Comments
3 comments