Hello,
I am currently trying to create a .crd which I pass an object to, and create a label with a barcode.
In some cases a specific field can have multiple values, and I’d like to iterate over these to be able to build text in a textfield. I couldn’t find any examples or hints for this so I figured I’d ask here.
At the moment, I’m doing this :
class Barcode
{
public int Id { get; set; }
public string Field1 { get; set; }
public string Field2 { get; set; }
}
Which works fine for output on a label. However, I’d like to do this :
class Barcode
{
public int Id { get; set; }
public string Field1 { get; set; }
public List<string> Field2 { get; set; }
}
, and then be able to iterate over Field2, and output the value of each row in the list to a textfield. When I pass this to the designer, Field2 disappears from my Barcode in the variable list.
If that doesn’t work, something like a split function where you can iterate over the result works as well, but I haven’t found such a method.
Something like :
string Field2 = "Value1;Value2;Value3";
And let me iterate over this. Any suggestions would be most welcome.
Hello,
what LL is doing in .crd mode seems ok, because of there is not able to use table data (co report container exists within this kind of project. Therefore you had to use a list project (.lst) instead a card project (*.crd) - see also project types
Just an idea (un-tested!): But in your case you can try to use this class which result into a “big” string for field Values with separated values and this is just one variable in List & Label you could parse:
class Barcode
{
public int Id { get; set; }
public string Field1 { get; set; }
public string Values
{
get
{
return String.Join(",", Field2);
}
set
{
Values = value;
}
}
public List<string> Field2 { get; set; }
}
Thanks for your input. At the moment, I’m passing a string with linebreaks to LL, which outputs what I want to achieve - a new line for each instance of Field2.
I couldn’t find any sensible information regarding the parsing in the documentation, any hints on something like a String.Split() or something I could use?
So, if you mean now to split the “big” value within the designer you can try to use the inplace designer functions Token$
or Case$()
to get just a special part of the “big” string value. Just a simple sample that returns test3
: Token$("test1¶test2¶test3¶test4", 2, "¶")
But for more dynamic you should have a look for using real table objects within the designer by using der list project type.
1 Like
I will take a look at them, thank you for your input
2 Likes