Hi,
I have dataport based on temporary table - it works, but I need something more. I need to export only choosen set of fields from Dataport fields. Elements (fields) on set depends on one value in this temporary table, e.g.
Dataport fields
f1
f2
.
.
.
fn
if f1 = value 1 then
"export fields: f2,f3,f5"
if f1 = value 2 then
"export fields: f6,f8,f10"
......
0
Comments
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Do you want this selection at run time?
Post your dataport. Need more information.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Why not pass it to a recordref and use the fieldref and do your exporting manipulation.
That,s my dataport
When I pass it to a recordref I also have to select a set to export.
Could you please explain your point?
You can define three variables called column1, column2 and column3, of type text. These would be the SourceExpressions in your Field Designer.
Then you can add the following code to your Dataport:
Assuming that we have this table:
Our Dataport would look like this:
but how to write several dataports to the same file not override it? :-k
It is good idea?
Or maybe I just should write to file manually? I have from 19 to 32 fields for each record and I need sparator '|' between fields. #-o
where line is the SourceExpression for your only entry in Field Designer.
You may need to do additional padding using the PADSTR(String, Length [, FillCharacter]) function, if you need that.
You can have two DataItems on the Xml Port. They would have different DataItemTableView properties, filtering on the TransferType field (doing the same thing with the if TransferType = ... statement we used before). Since each DataItem can have a different set of DataPort Fields list, the only thing you need to do is to set the DataItemSeparator property to <NewLine>, so that output will not have a blank line in between.
Assuming that TransferType can be 'Odd' or 'Even' only, I defined two DataItems with corresponding filters. (I also removed the temporary table from code.)
The problem with this is the two RequestForm tabs you get in addition to Options tab. But if you are able to suppress the RequestForm, it should not be a problem.
Code looks like this, then: