Skip to main content
Solved

Variable Retriever not receiving value from Variable Setter

  • October 12, 2021
  • 7 replies
  • 122 views

chris_acc
Contributor
Forum|alt.badge.img+5

Hello,

I am trying to obtain Max OBJECTID value from a database and pass it into Variable Setter.

The SQL Creator > Variable Setter is obtaining the correct value (just one record at present) but the Variable Retriever cannot obtain the value I think?

I hope this is a simple step or order I am missing.

Thanks in advance

Best answer by nielsgerrits

chris_acc wrote:

Not sure how legible my workbench is but will hopefully give you an idea of the process.

 

As I already have a FeatureMerger i'm not sure if i can add another one (where?) or adapt the existing one (how?)

 

Turned caching off, it doesn't generate any polygons just the attributes.

 

The VariableSetter is upstream from the VariableSetter is it not?

 

Thank you

With you current setup it is possible that the SQLCreator fires after the other readers. The order on the Canvas has nothing to do with the order the initiation transformers (SQLCreator / Readers) are fired. I think the Readers will fire first, the SQLCreator as last. Remember, the workflow runs serial, not parallel.

 

If you replace the VariableRetriever with a FeatureMerger, connect the stream from the AttributeRounder to Requestor, SQLCreator to Supplier and set the "Join On" Requestor and Supplier Parameters both to 1, it will join the feature from the SQLCreator to each feature which passes the FeatureMerger.

 

2021-10-12_14h30_18

View original
Did this help you find an answer to your question?

7 replies

nielsgerrits
VIP
Forum|alt.badge.img+54

Personally I would solve this in another way. I would use a FeatureMerger with values 1=1 to supply maxobjectid to all the requestors. Or use a FeatureReader initiated by the SQLExecutor and merge maxobjectid to all features when they are being read.

 

See the "Partial Run" warning, you are using FeatureCaching, first try if it works as expected with FeatureCaching turned off. I think this is your issue.

 

If this does not solve it, make sure the VariableSetter is run upstream of your VariableRetriever. The value needs to be set before it is retrieved, else it will retrieve nothing.


chris_acc
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • October 12, 2021
nielsgerrits wrote:

Personally I would solve this in another way. I would use a FeatureMerger with values 1=1 to supply maxobjectid to all the requestors. Or use a FeatureReader initiated by the SQLExecutor and merge maxobjectid to all features when they are being read.

 

See the "Partial Run" warning, you are using FeatureCaching, first try if it works as expected with FeatureCaching turned off. I think this is your issue.

 

If this does not solve it, make sure the VariableSetter is run upstream of your VariableRetriever. The value needs to be set before it is retrieved, else it will retrieve nothing.

Not sure how legible my workbench is but will hopefully give you an idea of the process.

 

As I already have a FeatureMerger i'm not sure if i can add another one (where?) or adapt the existing one (how?)

 

Turned caching off, it doesn't generate any polygons just the attributes.

 

The VariableSetter is upstream from the VariableSetter is it not?

 

Thank you


ebygomm
Influencer
Forum|alt.badge.img+39
  • Influencer
  • October 12, 2021

To ensure the variable is set before being retrieved, I would look at using feature readers to read the data and have them triggered by the output of the SQLcreator


nielsgerrits
VIP
Forum|alt.badge.img+54
  • Best Answer
  • October 12, 2021
chris_acc wrote:

Not sure how legible my workbench is but will hopefully give you an idea of the process.

 

As I already have a FeatureMerger i'm not sure if i can add another one (where?) or adapt the existing one (how?)

 

Turned caching off, it doesn't generate any polygons just the attributes.

 

The VariableSetter is upstream from the VariableSetter is it not?

 

Thank you

With you current setup it is possible that the SQLCreator fires after the other readers. The order on the Canvas has nothing to do with the order the initiation transformers (SQLCreator / Readers) are fired. I think the Readers will fire first, the SQLCreator as last. Remember, the workflow runs serial, not parallel.

 

If you replace the VariableRetriever with a FeatureMerger, connect the stream from the AttributeRounder to Requestor, SQLCreator to Supplier and set the "Join On" Requestor and Supplier Parameters both to 1, it will join the feature from the SQLCreator to each feature which passes the FeatureMerger.

 

2021-10-12_14h30_18


chris_acc
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • October 12, 2021
chris_acc wrote:

Not sure how legible my workbench is but will hopefully give you an idea of the process.

 

As I already have a FeatureMerger i'm not sure if i can add another one (where?) or adapt the existing one (how?)

 

Turned caching off, it doesn't generate any polygons just the attributes.

 

The VariableSetter is upstream from the VariableSetter is it not?

 

Thank you

MAXOBJECTID_not_addingThanks

Whilst MAXOBJECTID now seems to be populating it is adding the same number repeatedly instead of adding '1' in order to generate a unique number in each row i.e. 284, 285, 286 etc.

I tried a Counter in between SQLCreator and FeatereMerger_2 but this did not work.


nielsgerrits
VIP
Forum|alt.badge.img+54
chris_acc wrote:

Not sure how legible my workbench is but will hopefully give you an idea of the process.

 

As I already have a FeatureMerger i'm not sure if i can add another one (where?) or adapt the existing one (how?)

 

Turned caching off, it doesn't generate any polygons just the attributes.

 

The VariableSetter is upstream from the VariableSetter is it not?

 

Thank you

If you want to generate new id, place the counter after the FeatureMerger, then an AttributeCreator to create objectid = maxobjectid + _count.


chris_acc
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • October 13, 2021
chris_acc wrote:

Not sure how legible my workbench is but will hopefully give you an idea of the process.

 

As I already have a FeatureMerger i'm not sure if i can add another one (where?) or adapt the existing one (how?)

 

Turned caching off, it doesn't generate any polygons just the attributes.

 

The VariableSetter is upstream from the VariableSetter is it not?

 

Thank you

Thanks, managed to resolve just with Counter after FeatureMerger


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings