0
struct Sellers{
    address sellerAddress;
    uint parcelId;
    uint parcelPrice;
}

In this struct I've entered multiple parcel Ids to sellerAddress and I've retreived them using _sellerAddress.

But Now I want to retreive SellerAddress from ParcelId?

What is the exact logic for it?

0

You can create a mapping from parcelId to Seller struct, like this:

struct Seller {
    address sellerAddress;
    uint parcelId;
    uint parcelPrice;
}

mapping(uint => Seller) sellers;

Then you can access the seller address from parcel id like this:

sellers[parcelId].sellerAddress;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.